ASP.NET的IIS7身份验证配置

时间:2021-05-29 18:13:34

I'm trying to set up ASP.net MVC4, hosting it with IIS7.

我正在尝试设置ASP.net MVC4,使用IIS7托管它。

When performing a get request to my API, I get the following error:

在对我的API执行get请求时,出现以下错误:

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

描述:处理为此请求提供服务所需的配置文件时发生错误。请查看下面的具体错误详细信息并相应地修改配置文件。

Parser Error Message: 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.

分析器错误消息:在应用程序级别之外使用注册为allowDefinition ='MachineToApplication'的部分是错误的。此错误可能是由于未在IIS中将虚拟目录配置为应用程序引起的。

Source Error:

来源错误:

Line 27:   <system.web>
Line 28:     <compilation debug="true" targetFramework="4.0" />
Line 29:     <authentication mode="None" />
Line 30:     <pages>
Line 31:       <namespaces>

Source File: C:\inetpub\wwwroot\api\web.config Line: 29

源文件:C:\ inetpub \ wwwroot \ api \ web.config行:29

Line 29 is highlighted in red. Any help would be greatly appreciated

第29行以红色突出显示。任何帮助将不胜感激

Joe

1 个解决方案

#1


5  

you cannot define authentication mode in the config file (web.config) in IIS7 unless you 'allow' it by updating the machine.config. Instead change the authentication settings in the IIS7 Management console.

您无法在IIS7中的配置文件(web.config)中定义身份验证模式,除非您通过更新machine.config来“允许”它。而是在IIS7管理控制台中更改身份验证设置。

http://technet.microsoft.com/en-us/library/cc733010(v=ws.10).aspx

http://technet.microsoft.com/en-us/library/cc733010(v=ws.10).aspx

MORE: The 'authentication' web.config settings are required to configure authentication in IIS Express, but they should be omitted when deploying to IIS.

更多:在IIS Express中配置身份验证需要“身份验证”web.config设置,但在部署到IIS时应省略它们。

To support this sort of configuration in IIS Express you must 'allow authentication' by changing the applicationHost.config

要在IIS Express中支持此类配置,您必须通过更改applicationHost.config来“允许身份验证”

MORE: http://www.hanselman.com/blog/WorkingWithSSLAtDevelopmentTimeIsEasierWithIISExpress.aspx

更多:http://www.hanselman.com/blog/WorkingWithSSLAtDevelopmentTimeIsEasierWithIISExpress.aspx

#1


5  

you cannot define authentication mode in the config file (web.config) in IIS7 unless you 'allow' it by updating the machine.config. Instead change the authentication settings in the IIS7 Management console.

您无法在IIS7中的配置文件(web.config)中定义身份验证模式,除非您通过更新machine.config来“允许”它。而是在IIS7管理控制台中更改身份验证设置。

http://technet.microsoft.com/en-us/library/cc733010(v=ws.10).aspx

http://technet.microsoft.com/en-us/library/cc733010(v=ws.10).aspx

MORE: The 'authentication' web.config settings are required to configure authentication in IIS Express, but they should be omitted when deploying to IIS.

更多:在IIS Express中配置身份验证需要“身份验证”web.config设置,但在部署到IIS时应省略它们。

To support this sort of configuration in IIS Express you must 'allow authentication' by changing the applicationHost.config

要在IIS Express中支持此类配置,您必须通过更改applicationHost.config来“允许身份验证”

MORE: http://www.hanselman.com/blog/WorkingWithSSLAtDevelopmentTimeIsEasierWithIISExpress.aspx

更多:http://www.hanselman.com/blog/WorkingWithSSLAtDevelopmentTimeIsEasierWithIISExpress.aspx