Search code examples
asp.net-mvc-3iis-7wcf-data-services

404 error when accessing a WCF Data Server On MVC 3, IIS 7


I know, there are quite a few search results for this problem, but nothing helped.

The WCF data service runs happily in the dev environment, on the staging server, but not on the live box. I've tried the

routes.IgnoreRoute("API4/HUB.svc");
routes.IgnoreRoute("API4/HUB.svc/{*pathInfo}");

But that just changed the error from a MVC 404 to an IIS 404.

Interestingly, I have already a few WCF services running, but the is the first WCF Data Service.

As I say, I've tried everything Google suggested and would be grateful for any hints.

Here is the entire web.config (with some sensitive data removed):

<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <!--<section name="uri" type="System.Configuration.UriSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>-->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
      <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
          <section name="MomentumHub.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
      </sectionGroup>
  </configSections>
  <appSettings>
    <add key="webpages:Version" value="1.0.0.0" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />

  </appSettings>
  <connectionStrings>
    <add name="HUBAPIdb" connectionString="metadata=res://*/API4.HUBAPIdb.csdl|res://*/API4.HUBAPIdb.ssdl|res://*/API4.HUBAPIdb.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=.\;initial catalog=HUB;user id=...;password=...;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>
  <system.web>
    <compilation debug="true" targetFramework="4.5">
      <assemblies>
        <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
      </assemblies>
    </compilation>
    <authentication mode="Forms">
      <forms loginUrl="~/Account/Login" timeout="2880" />
    </authentication>
    <membership defaultProvider="HUBMembershipProvider">
      <providers>
        <clear/>
        <add name="HUBMembershipProvider" type="MomentumHub.Models.HUBMembershipProvider, MomentumHub" />
      </providers>
    </membership>
    <roleManager defaultProvider="HUBRoleProvider" enabled="true" cacheRolesInCookie="true">
      <providers>
        <clear/>
        <add name="HUBRoleProvider" type="MomentumHub.Models.HUBRoleProvider, MomentumHub" />
      </providers>
    </roleManager>
    <pages>
      <namespaces>
        <add namespace="System.Web.Helpers" />
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Routing" />
        <add namespace="System.Web.WebPages" />
      </namespaces>
    </pages>
  </system.web>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules runAllManagedModulesForAllRequests="true">
      <remove name="WebDAVModule" />
    </modules>
  </system.webServer>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0" />
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="4.5.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
      <bindings>
          <basicHttpBinding>
              <binding name="TextAnywhere_SMSSoap" closeTimeout="00:01:00"
                openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                useDefaultWebProxy="true">
                  <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                  <security mode="None">
                      <transport clientCredentialType="None" proxyCredentialType="None"
                        realm="" />
                      <message clientCredentialType="UserName" algorithmSuite="Default" />
                  </security>
              </binding>
              <binding name="ServiceSoap" />
          </basicHttpBinding>
      </bindings>
      <client>
          <endpoint address="http://ws.textanywhere.net/ta_sms.asmx" binding="basicHttpBinding"
            bindingConfiguration="TextAnywhere_SMSSoap" contract="TextAnywhere_SMS.TextAnywhere_SMSSoap"
            name="TextAnywhere_SMSSoap" />
          <endpoint address="http://www.textapp.net/webservice/service.asmx" binding="basicHttpBinding" bindingConfiguration="ServiceSoap" contract="TextAnywhere_SMS_v2.ServiceSoap" name="ServiceSoap" />
      </client>
  </system.serviceModel>
  <!--<uri>
    -->
  <!-- The uri section is necessary to turn on .NET 3.5 support for IDN (international domain names),
         which is necessary for OpenID urls with unicode characters in the domain/host name. 
         It is also required to put the Uri class into RFC 3986 escaping mode, which OpenID and OAuth require. -->
  <!--
    <idn enabled="All"/>
    <iriParsing enabled="true"/>
  </uri>-->
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="data source=.\;initial catalog=HUB;user id=...;password=...;multipleactiveresultsets=True" />
      </parameters>
    </defaultConnectionFactory>
  </entityFramework>
    </applicationSettings>
</configuration>

Solution

  • I found the problem. It was the Plesk on the server. It thought it is a good idea to remove all standard HTTP Handlers and replace them with proprietary Plesk ones, which wouldn't handle WCF Data services.