2011-12-11 70 views
0

我做了一个WCF REST服务和Silverlight客户端。本地主机(开发服务器)上的通信(基于XML)工作正常,但不在IIS 7.5(Windows Server 2008 R2)上。 WCF服务成功托管在IIS上,但是当客户端发送服务请求时,服务返回状态:中止(wtf? - 不是像404,200的HTML经典状态,但已中止)。 Silverlight客户端抛出System.Net.WebException:远程服务器返回一个错误:NotFound。但是,如果我连续发送两个请求,第一个返回Aborted,第二个WORKS!然后Silverlight下降。我不明白...先谢谢你的回答!在IIS中托管的WCF - 配置问题

WCF的Web.config:

<?xml version="1.0"?> 

<configuration> 
    <system.web> 
    <compilation debug="true" targetFramework="4.0" /> 
    </system.web> 

    <system.serviceModel>  
    <services> 
     <service name="RESTapi_test.RestServiceImpl" behaviorConfiguration="ServiceBehavior"> 
     <endpoint address="" binding="webHttpBinding" contract="RESTapi_test.IRestServiceImpl" 
       behaviorConfiguration="web" > 

     </endpoint> 
     <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> 
     </service> 
    </services> 

    <behaviors> 
    <serviceBehaviors> 
    <behavior name="ServiceBehavior"> 
     <serviceMetadata httpGetEnabled="true"/> 
     <serviceDebug includeExceptionDetailInFaults="true" /> 
    </behavior> 
    </serviceBehaviors> 
    <endpointBehaviors> 
    <behavior name="web"> 
     <webHttp/> 
    </behavior> 
    </endpointBehaviors> 
    </behaviors> 

    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" /> 

    </system.serviceModel> 

    <system.webServer> 
    <modules runAllManagedModulesForAllRequests="true"/> 
    </system.webServer> 

</configuration> 

回答

0

启用您的服务Tracing并检查跟踪文件知道为什么你的第一个请求失败,而不是第二个原因。还要确保IIS上的服务配置。