且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

获得"默认文档没有配置"在IIS 7.5部署ASP.NET MVC应用程序时的错误

更新时间:2023-01-18 22:05:10

有两种可能的解决方案。


  1. 确认正在运行你的网站的应用程序池设置为第4版很可能默认为V2,这将给你在你的问题中提到的所有错误。


  2. 重新注册使用此命令你的框架:



  

C:\\ WINDOWS \\ Microsoft.NET \\框架\\ v4.0.30319 \\ aspnet_regiis的-i


块引用>

我也想还原您所做的这些更改(例如把 targetFramework 属性回)

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?

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)