In this article we are going to see how we can fix if you are getting some reference errors, or if your bundles are not getting configured properly in your server. I have fixed this issue, and here I am going to share you how you can also fix this error. I hope you will like this.
Recently I hosted one of my MVC application to Microsoft Azure cloud. And we usually publish our application in release mode right? So here the problem comes. You can replicate the same issue in your local machine itself. Just make the debug attribute to false in your Web.config as follows.
<compilation debug="false" targetFramework="4.5" />
And when you run, you will get a prompt as follows.
Just select Run without debugging option. Now once after your application is run, you can see some script errors in your browser console saying that the references are not loaded correctly.
And finally I could find the solution. Here we will see that.
Bundles Are Not Working After Hosting To MVC Application
As I said, the problem is with your bundle config settings. There are few things you must check before going to the last fix.
If none of the above solution works, you can try the last one.
I will explain it. In my case my bundles were as follows.
And I have the folders JQWidgets in my root script folder. This was making the issue.
Now what I did is, I just changed my bundle config settings in BundleConfig.cs as follows(Renaming the folder)
And I referenced the same bundles as follows in my views.
Please try these steps and build your application. Once that is done you can publish your application to cloud. I hope this will solve your issue. Have a happy coding.
Did I miss anything that you may think which is needed? Could you find this post as useful? I hope you liked this article. Please share me your valuable suggestions and feedback.
Your turn. What do you think?
A blog isn’t a blog without comments, but do try to stay on topic. If you have a question unrelated to this post, you’re better off posting it on C# Corner, Code Project, Stack Overflow, Asp.Net Forum instead of commenting here. Tweet or email me a link to your question there and I’ll definitely try to help if I can.