简体   繁体   中英

IIS7 authentication configuration for ASP.NET

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

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

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.

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

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

Joe

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.

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.

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM