2013-05-22 50 views
1

我知道,這個問題有不少搜索結果,但沒有任何幫助。訪問WCF數據服務器時出現404錯誤在MVC 3上,IIS 7

WCF數據服務在開發環境中,在登臺服務器上運行愉快,但不在活動框上運行。 我已經試過

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

但是,這只是改變了錯誤從MVC 404到404 IIS

有趣的是,我已經跑了幾個WCF服務,但是是第一個WCF數據服務。

正如我所說,我已經嘗試了谷歌建議的一切,並會感激任何提示。

這裏是整個的web.config(除去一些敏感的數據):

<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> 
+0

潛在.net版本問題?生產服務器上是否安裝了.net 4.5?我有一個wcf服務運行在mvc應用程序之前,忽略路由'routes.IgnoreRoute(「{resource} .svc/{* pathInfo}」);'應用程序池配置爲使用錯誤的.net版本? – WestDiscGolf

+0

只需雙重檢查:安裝了.NET 4.5,該應用程序使用4.0應用程序池。應該可以。 – tkglaser

+0

您是否嘗試從暫存服務器導出您的IIS設置,並嘗試將它們與生產中的設置進行比較?甚至可能將它們導入到生產中以創建所需的站點/虛擬目錄?通配符映射阻礙了嗎? * .svc設置與其他擴展一起使用? *劃痕頭* – WestDiscGolf

回答

0

發現問題。這是服務器上的Plesk。它認爲刪除所有標準的HTTP處理程序並將其替換爲專有的Plesk程序是不錯的主意,這些程序不會處理WCF數據服務。

相關問題