« Previous Next »

Answered Thread: WCF Service Deployed to IIS7 issues

Last post 10-25-2009 2:31 AM by anupambanerji. 4 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (5 items)

Sort Posts:

  • 10-24-2009, 9:34 AM

    WCF Service Deployed to IIS7 issues

    Hi,

    I deployed my WCF service to an IIS7 server.  When I type the service name, this is what I see:

     
    <%@ ServiceHost Language="C#" Debug="true" Service="SiteDataService.DataService" CodeBehind="DataService.svc.cs" %> 
     
    The http request returns the above string.  To see this for yourself type http://services.coactumsolutions.com/DataService.svc into a browser window.
     
    My web.config file has a couple of handlers and a MIME type:
     
    <system.web>
    

    ... 

    <httpHandlers>

    <remove verb="*" path="*.asmx"/>

    <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

    <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

    <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>

    <add verb="*" path=".svc" type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>

    </httpHandlers>

    <httpModules>

    <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

    </httpModules>

     

    </system.web>

    
    

    <!--

    The system.webServer section is required for running ASP.NET AJAX under Internet

    Information Services 7.0. It is not necessary for previous version of IIS.

    -->

    <system.webServer>

    <validation validateIntegratedModeConfiguration="false"/>

    <modules>

    <add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

    </modules>

    <handlers>

    <remove name="WebServiceHandlerFactory-Integrated"/>

    <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

    <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

    <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

    <!-- Uncommenting the line below throws a 404.0 error! -->

    <!--<add name="svc-Integrated" path="*.svc" verb="*" type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="integratedMode" />-->

    <add name="svc-ISAPI-2.0" path="*.svc" verb="*" modules="IsapiModule" scriptProcessor="%SystemRoot%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness32" />

    </handlers>

    <staticContent>

    <mimeMap fileExtension=".svc" mimeType="application/octet-stream" /></staticContent>

    </system.webServer>

     
    <system.serviceModel>
    

    <serviceHostingEnvironment>

    <baseAddressPrefixFilters>

    <add prefix ="http://services.coactumsolutions.com/"/>

    </baseAddressPrefixFilters>

    </serviceHostingEnvironment>

    <services>

    <service behaviorConfiguration="SiteDataService.DataServiceBehavior" name="SiteDataService.DataService">

    <host>

    <baseAddresses>

    <add baseAddress ="http://services.coactumsolutions.com/"/>

    </baseAddresses>

    </host>

    <endpoint address="" binding="basicHttpBinding" contract="SiteDataService.ISqlClass">

    <identity>

    <!--<dns value="174.120.147.66"/>-->

    </identity>

    </endpoint>

    <!--<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange">

    </endpoint>-->

    </service>

    </services>

    <behaviors>

    <serviceBehaviors>

    <behavior name="SiteDataService.DataServiceBehavior">

    <serviceMetadata httpGetEnabled="true"/>

    <serviceDebug includeExceptionDetailInFaults="true"/>

    </behavior>

    </serviceBehaviors></behaviors>

    </system.serviceModel>

     

    Any ideas as to why this happens, and how I can fix it?
  • 10-24-2009, 10:58 PM In reply to

    • Sansom
    • Top 500 Contributor
    • Joined on 11-14-2006, 3:57 AM
    • Bangalore
    • Posts 22

    Answered Re: WCF Service Deployed to IIS7 issues

    If you are seeing the content of the .svc file in the browser, make sure the mime type is set properly. .svc extension is mapped to a handler.

    try running %windir%\Microsoft.net\framework\v3.0\WindowsCommunicationFoundation\servicemodelreg -i

    Make sure you have installed the http endpoints

    Cheers,
    Santhosh

    visit my blogs at
    http://blogs.msdn.com/sansom
  • 10-24-2009, 11:23 PM In reply to

    Re: WCF Service Deployed to IIS7 issues

    I do have a MIME type for the service in the above config file:

    <mimeMap fileExtension=".svc" mimeType="application/octet-stream" /> 

    Unfortunately, I can't change any settings in IIS7; the service is deployed to a remote host.  The host assures me that everything at their end is fine.

    I do map the svc extension to (just one) handlers as below:

    <handlers>

    <!-- Uncommenting the line below throws a 404.0 error! -->

    <!--<add name="svc-Integrated" path="*.svc" verb="*" type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="integratedMode" />-->

    <add name="svc-ISAPI-2.0" path="*.svc" verb="*" modules="IsapiModule" scriptProcessor="%SystemRoot%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness32" />

    </handlers>

    Any ideas?

     

     

     

  • 10-25-2009, 1:49 AM In reply to

    • Sansom
    • Top 500 Contributor
    • Joined on 11-14-2006, 3:57 AM
    • Bangalore
    • Posts 22

    Re: WCF Service Deployed to IIS7 issues

    You can ask your host to run Servicemodelreg -i

    IIS throwing 404 indicates .svc not registered with IIS.

    Cheers,
    Santhosh

    visit my blogs at
    http://blogs.msdn.com/sansom
  • 10-25-2009, 2:31 AM In reply to

    Re: WCF Service Deployed to IIS7 issues

    I uncommented the first line and it miraculously worked.

    Probably a setting the host made by running servicemodelreg.

    I'm switching to a new host, so problem solved for now.

    Thanks guys.

Page 1 of 1 (5 items)
Microsoft Communities