5

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

1 Answer 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.

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

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for your help Glenn, I have deleted the line from web.config and updated the authentication settings in IIS as shown in this screenshot: i61.photobucket.com/albums/h47/joeacton/auth.png And I now get this new error: i61.photobucket.com/albums/h47/joeacton/error.png Any ideas? Thanks, Joe
That message (like the others) means that the settings you are placing in your web.config are meant to be configured in IIS, not in the code of a config file. you can always override those settings in the machine.config

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.