Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 245
user977380 Avatar asked Sep 20 '12 19:09

user977380


People also ask

How do I enable IIS Basic Authentication?

In the Web Server (IIS) pane, scroll to the Role Services section, and then click Add Role Services. On the Select Role Services page of the Add Role Services Wizard, select Basic Authentication, and then click Next. On the Confirm Installation Selections page, click Install. On the Results page, click Close.

What is ASP.NET impersonation authentication?

When using impersonation, ASP.NET applications can execute with the Windows identity (user account) of the user making the request. Impersonation is commonly used in applications that rely on Microsoft Internet Information Services (IIS) to authenticate the user. ASP.NET impersonation is disabled by default.


1 Answers

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

like image 200
Glenn Ferrie Avatar answered Oct 03 '22 07:10

Glenn Ferrie