Deploying ASP MVC 5 App with IIS 7.5

2019-06-06 04:05发布

问题:

I try to deploy ASP MVC 5 app in virtual directory (without creating new iis application) I use IIS 7.5

I already put

<modules runAllManagedModulesForAllRequests="true"/> 
<directoryBrowse enabled="true" />

in web.config file. But when i go to app url with IE browser it shows me just directory listing like in screenshot below

Is there a way to deploy MVC 5 in virtual directory and make it work like usual MVC application?

回答1:

You need to convert the virtual directory to application. Right click on it in the IIS management console and choose Convert To Application.... Also make sure that the associated application is configured to use Integrated Pipeline Mode.



回答2:

I solved this problem earlier in my production environment by checking the directory pointer in IIS. Apparently when I unzipped the deployed site from one server to the next, the zip utility made an extra level, so IIS was pointing to /MyProject when the files were in /MyProject/MyProject. I had a little better clue though, you have Document Browsing enabled based on that screen shot, make sure not to do that in production. I set the site to log custom errors and got a 403.14 response, from there found a blog on my mistake. You need to setup the environment to find the specific module that's failing, I think something to do with trace routes, idk. I'm a software developer that always gets forced into doing devOps; was googling my own problem and thought I'd throw you a line. Without a specific error message, all I can tell you is IIS is not connecting to .NET; something is not configured correctly. Turn off directory browsing, google how to get good error logs back, and let us know the status code so we can help you: 403.14, 401, 500, 404? Also give us the module that's failing. If it's the last one on the handler list, guess what, IIS isn't connecting to the app, which I suspect is your case.