Question

I was trying to build RESTful API, but I am getting an error in web.config file. Error is as below

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.

Here is web.config code:

<?xml version="1.0"?>
<configuration>

  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
  <system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true">
    </serviceHostingEnvironment>
    <standardEndpoints>
      <webHttpEndpoint>
        <standardEndpoint name="" helpEnabled="true"
    automaticFormatSelectionEnabled="true"></standardEndpoint>
      </webHttpEndpoint>
    </standardEndpoints>
  </system.serviceModel>

 <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>

</configuration>

Please help me out, if you think this information is not enough for you. Please see complete code at http://www.codeproject.com/Articles/255684/Create-and-Consume-RESTFul-Service-in-NET-Framewor

Was it helpful?

Solution

I'm not sure if you have seen this one, there's lots of options:

https://stackoverflow.com/questions/2355947/error-allowdefinition-machinetoapplication-beyond-application-level

The one i would try first would be the "Clean Application" in the Build menu

Martyn

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top