2012-09-07 48 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)。
  • 扩展名为。*
  • 取消选中“检查文件是否存在”。
  • 单击确定。