2014-03-07 63 views
1

自動生成WSDL我有一個WCF服務MyService.svc,在IIS 7的託管服務配置是這樣的:WCF - 不工作

<system.serviceModel> 
    <services> 
     <service name="MyService"> 
      <endpoint address="" binding="basicHttpBinding" contract="MyPortType"></endpoint> 
     </service> 
    </services> 
    <behaviors> 
     <serviceBehaviors> 
      <behavior name="defaultBehaviour"> 
       <serviceMetadata httpGetEnabled="true" /> 
       <serviceDebug includeExceptionDetailInFaults="true" /> 
      </behavior> 
     </serviceBehaviors> 
    </behaviors> 
</system.serviceModel> 

的問題是,我的服務不提供自動生成WSDL (添加?WSDL服務的URL),儘管事實上,我包括標籤

<serviceMetadata httpGetEnabled="true" /> 

服務本身是工作,如果我試圖通過了SoapUI調用它。當我嘗試訪問WSDL時,我得到了HTTP錯誤400並且沒有響應WSDL。

重要的是要注意,我使用.NET 3.5和Visual Studio 2008的遺留原因(它是一箇舊的應用程序)。數據合約是通過命令行使用VS2008中的svcutil.exe生成的。當我在VS 2013/.NET 4.5(使用VS2013的svcutil.exe生成regenerad數據契約類)時嘗試了相同的服務和相同的配置時,自動生成的WSDL顯示沒有問題。

我該怎麼做才能在.NET 3.5/VS2008下獲得自動生成的WSDL?

謝謝 米哈爾

回答

0

,如果你刪除你的行爲的名稱,就應該把它撿起來。

<serviceBehaviors> 
     <behavior name="defaultBehaviour"> 
      <serviceMetadata httpGetEnabled="true" /> 
      <serviceDebug includeExceptionDetailInFaults="true" /> 
     </behavior> 
    </serviceBehaviors> 

 <serviceBehaviors> 
     <behavior> 
      <serviceMetadata httpGetEnabled="true" /> 
      <serviceDebug includeExceptionDetailInFaults="true" /> 
     </behavior> 
    </serviceBehaviors> 
+0

我想這一點,可惜的是它不工作。行爲仍然是一樣的。不過謝謝你。 – Mikee

1

添加元數據端點服務

<services> 
     <service name="MyService"> 
      <endpoint address="" binding="basicHttpBinding" contract="MyPortType"></endpoint> 
    <endpoint address=」mex」 binding=」mexHttpBinding」 contract=」IMetadataExchange」/> 
    </service> 
</services>