views:

122

answers:

1

Hi,

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?

+1  A: 

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.

JeffN825
thanks for this man, i have checked and found out that my application creates its own application pool that uses asp.net 2.0 instead of 4.0. Now its working. Thank you very much.
mcxiand