Getting “A default document is not configured ” error when deploying ASP.NET MVC application on IIS 7.5

三世轮回 提交于 2019-12-11 04:12:16

问题


Developing an ASp.NET MVC 5 application. Runs without an issue on the development machine (Windows 7 x86). When I tried to deploy it on IIS 7.5 (Win Server 2008 R2 64 bit) I got 3 errors:

  1. Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive.

I fixed this issue by removing targetFramework="4.5" from

<compilation debug="true" targetFramework="4.5">
  1. The tag contains an invalid value for the 'culture' attribute.

I don't know why but compliant was about the following entry:

<globalization enableClientBasedCulture="true" culture="az-Latn" uiCulture="az-Latn" />

After removing culture="az-Latn" uiCulture="az-Latn" this problem also got solved. But I don't think this is a proper way of solving that, so it'd be good to know the right solution.

  1. Now the third error is the one that's taken all my day. After solving the above two problems now I get the error in the image:

The best solution that seems to work for almost everybody is to add the following entry:

    <modules runAllManagedModulesForAllRequests="true" />

But I already have it in the config file. IIS was missing URLRewrite module so I installed it manually.(Don't know if this has anything to do with it though). Didn't help. Enabled 32 bit Applications. Didn't help. What else should I try?


回答1:


There are two possible solutions

  1. Make sure the application pool that is running your site is set to version 4. It's likely defaulted to v2 which will give you all the errors you mentioned in the question.

  2. Re-register your framework with this command:

C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis -i

I'd also revert those changes you have made (e.g. put the targetFramework attribute back in)



来源:https://stackoverflow.com/questions/25930846/getting-a-default-document-is-not-configured-error-when-deploying-asp-net-mvc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!