Reputation: 4420
I have a windows Authentication for My MVC5 projec. It is working locally but when I publish it to the server, I get this error:
It is an error to use a section registered as allowDefinition='MachineToApplication'
beyond application level.
This error can be caused by a virtual directory not being configured
as an application in IIS.
I have this line in my web.config
<authentication mode="Windows"/>
but in MVC there is another config file under the "view" as well. I also added to that too but same error. Any thought?
Upvotes: 1
Views: 319
Reputation: 1825
This is one of those errors that really doesn't have a fix. You can try deleting all of your bin/obj files and see if that works. You can turn off the feature that pre-builds the view, which will probably resolve your issue but you lose other goodies like catching compile time exceptions on your views. You can stop the pre-publish builds on your view by editing Web.config like:
<PropertyGroup>
<MvcBuildViews>false</MvcBuildViews>
</PropertyGroup>
An alternative to the PropertyGroup is, (VS2013) right click your project -> publish -> Settings -> (uncheck) Precompile during publishing. As with the previous mentioned, you will lose compile time exceptions on your views.
*And remove the change you added to the Web.config in your views folder.
Just for clarity, check out this SO discussion MVCBuildViews not working correctly
**Note: these are not fixes, just workarounds that may or may not work for you.
Upvotes: 1
Reputation: 2539
Many reasons why you received that error message , but it's good you mentioned that is related to the production environment and no locally. I would suggest two things:
Upvotes: 0