2012-09-07 49 views
1

我有一個基於WCF的RESTful API(.NET Framework 4.0),它在IIS 7.0上託管時工作正常(Win7)或IIS 6.0(Server 2003)。但是,我發現在IIS 5.1(Windows XP)上託管網站的問題令人驚訝,因爲我認爲5.1和6.0只有託管網站的數量不同。在IIS 5.1(Windows XP)問題404(無法找到資源)上託管.NET 4.0 REST WCF服務

一切都很好,用下面的請求(the result screenshot):

http://localhost/test/api/OrderService.svc

所以我想我沒有註冊任何模塊,用於處理SVC文件或任何責任。 然而,下面的請求(the result screenshot):

http://localhost/test/api/OrderService.svc/rest/orders?format=json

返回HTTP代碼404 我檢查事件查看器,但一無所獲。

再次,一切工作在IIS 7.0和IIS 6.0上。 這裏是web.config文件(有些東西切割):

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 
    <system.web> 
    <compilation debug="true" targetFramework="4.0"> 
     <assemblies> 
     <add assembly="System.Web.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /> 
     <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> 
     <add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> 
     </assemblies> 
    </compilation> 
    <globalization uiCulture="auto" /> 
    <customErrors mode="Off" /> 
    </system.web> 
    <system.webServer> 
    <!--Это приложение определяет конфигурацию в разделе system.web/httpHandlers. 
    Если есть уверенность, что можно игнорировать эту ошибку, сообщение о ней можно отключить, установив для параметра system.webServer/[email protected] значение false. 
    Для запуска приложений ASP.NET на сервере IIS 7.0 и более поздних версий предпочтительным является интегрированный режим.--> 
    <validation validateIntegratedModeConfiguration="false" /> 
    <modules runAllManagedModulesForAllRequests="true"> 
     <remove name="WebDAVModule" /> 
     <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
     <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> 
    </modules> 
    <handlers> 
     <remove name="WebDAV" /> 
     <add name="AddAsmx" verb="*" path="*.asmx" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
     <add name="AppService" verb="*" path="*_AppService.axd" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
     <add name="ScriptResource" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
    </handlers> 
    </system.webServer> 
    <system.serviceModel> 
    <bindings> 
     <basicHttpBinding> 
     <binding name="soapBinding" closeTimeout="00:02:00" hostNameComparisonMode="Exact" maxBufferSize="120000" maxReceivedMessageSize="120000" > 
     <security mode="Transport" /> 
     </binding> 
     </basicHttpBinding> 
     <webHttpBinding> 
     <binding name="restBinding"> 
      <security mode="Transport" /> 
     </binding> 
     <!--http://social.msdn.microsoft.com/Forums/en/wcf/thread/845d0bbd-52b4-420f-bf06-793d53ef93ba--> 
     <!--<binding name="poxBinding"> 
     </binding>--> 
     </webHttpBinding> 
    </bindings> 
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="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="XDDF" maxBufferSize="120000" maxReceivedMessageSize="120000" helpEnabled="true" automaticFormatSelectionEnabled="true" /> 
     </webHttpEndpoint> 
    </standardEndpoints> 
    <services> 
     <service behaviorConfiguration="slBehavior" name="WcfServiceLibrary.OrderService"> 
     <endpoint address="soap" binding="basicHttpBinding" name="basicHttpBinding" bindingConfiguration="soapBinding" contract="WcfServiceLibrary.IOrderService" /> 
     <endpoint address="rest" binding="webHttpBinding" bindingConfiguration="restBinding" behaviorConfiguration="restBehavior" contract="WcfServiceLibrary.IOrderService" /> 
     <!--<endpoint address="pox" binding="webHttpBinding" bindingConfiguration="poxBinding" behaviorConfiguration="poxBehavior" contract="WcfServiceLibrary.IOrderService"/>--> 
     <endpoint address="mex" binding="mexHttpsBinding" name="mexHttpbinding" contract="IMetadataExchange" /> 
     </service> 
    </services> 
    <behaviors> 
     <endpointBehaviors> 
     <behavior name="restBehavior"> 
      <!--<enableWebScript/>--> 
      <webHttp /> 
     </behavior> 
     <!--<behavior name="poxBehavior"> 
      <webHttp /> 
      </behavior>--> 
     </endpointBehaviors> 
     <serviceBehaviors> 
     <behavior name="slBehavior"> 
      <serviceMetadata httpsGetEnabled="true" /> 
      <serviceDebug httpHelpPageEnabled="true" includeExceptionDetailInFaults="true" /> 
     </behavior> 
     <behavior name="returnFaults" /> 
     <behavior name=""> 
      <serviceMetadata httpGetEnabled="true" /> 
      <serviceDebug includeExceptionDetailInFaults="false" /> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    </system.serviceModel> 
</configuration> 

請幫助。我找不到任何有用的東西。

回答

3

爲我做了以下工作。

  • 在IIS上選擇應用程序的屬性。
  • 在虛擬目錄選項卡中選擇配置。
  • 點擊添加。選擇可執行文件爲aspnet_isapi.dll。 (通常路徑 對此將類似於
    c:\ windows \ microsoft.net \ framework \ v4.0.30319 \ aspnet_isapi.dll)。
  • 擴展名爲。*
  • 取消選中「檢查文件是否存在」。
  • 單擊確定。