2011-12-11 68 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上的服務配置。