Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IIS 7.5 Error on Restful WCF 4.0

I've been trying to do a simple restful wcf service that will return JSON. Its working if i will run it in the development server. However if I deploy it on IIS 7.5, i will have this error when i accessed it using http://localhost:70

HTTP Error 500.19 - Internal Server Error The requested page cannot be accessed because the related configuration data for the page is invalid.

Config Error The configuration section 'standardEndpoints' cannot be read because it is missing a section declaration

Here is my configuration file: This is the default file generated by the VS2010.

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

  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>

  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true">
      <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    </modules>
  </system.webServer>

  <system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
    <standardEndpoints>
      <webHttpEndpoint>
        <!-- 
            Configure the WCF REST service base address via the global.asax.cs file and the default endpoint 
            via the attributes on the <standardEndpoint> element below
        -->
        <standardEndpoint name="LocationService" helpEnabled="true" automaticFormatSelectionEnabled="true"/>
      </webHttpEndpoint>
    </standardEndpoints>
  </system.serviceModel>

</configuration>

Im new to WCF specially on .net 4.0 and IIS 7.5.

Can anybody help? Or anybody has experienced the same and has fixed already?

like image 717
mark vanzuela Avatar asked Sep 13 '10 23:09

mark vanzuela


1 Answers

Do you definitely have the IIS application pool for your site configured to run with ASP .NET 4.0?

Right click your Virtual Directory in IIS Manager > Manage Application > Advanced Settings > read the app pool name.

Then go to Application Pools, find that name and make sure the .NET Framework column says v4.0.

like image 159
Jeff Avatar answered Oct 22 '22 06:10

Jeff