我的WCF服務工作正常,然後突然停止工作。我認爲我沒有改變任何配置。WCF - 不會創建服務引用
WCF服務由Windows服務託管。
奇怪的是,當我添加服務引用時,它將識別合同和所有暴露的方法。但是,如果我去瀏覽器,我得到一個404錯誤,編譯器不創建服務。我已刪除並嘗試重新添加引用沒有運氣
此外,我部署的應用程序仍然能夠訪問wcf服務。
問題1: 在WCF windows服務中,我應該能夠在瀏覽器(http:// localhost:8080/MaestroService/mex)中看到wsdl。在IE中,我收到了400個錯誤的請求。我假設這是問題的根源。
問題2: 還有別的嗎?
的App.config
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="NewBinding0" />
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="metadataAndDebug">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug httpHelpPageEnabled="true" includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="metadataAndDebug" name="MaestroServiceLibrary.MaestroService">
<endpoint address="basic" binding="basicHttpBinding" bindingConfiguration="NewBinding0"
name="basicHttp" contract="MaestroServiceLibrary.IMaestroService" />
<endpoint address="mex" binding="mexHttpBinding" bindingConfiguration=""
contract="IMetadataExchange" />
<endpoint address="net.tcp://localhost:8888/MaestroService" binding="netTcpBinding"
bindingConfiguration="" name="netTcpBinding" contract="MaestroServiceLibrary.IMaestroService" />
<endpoint address="net.pipe://localhost/MaestroService" binding="netNamedPipeBinding"
bindingConfiguration="" name="netNamedPipeBinding" contract="MaestroServiceLibrary.IMaestroService" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8080/MaestroService" />
</baseAddresses>
</host>
</service>
</services>
錯誤編譯:
Custom tool error: Failed to generate code for the service reference 'MaestroService'. Please check other error and warning messages for details.
Custom tool warning: Cannot import wsdl:binding
Detail: There was an error importing a wsdl:portType that the wsdl:binding is dependent on.
XPath來的wsdl:portType的:// WSDL:定義[@的targetNamespace =「HTTP ://tempuri.org/']/wsdl:portType [@ name ='IMaestroService'] XPath來誤差來源://wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:binding[@name='basicHttp']
更新
我打開跟蹤,我看到: 由於EndpointDispatcher中的AddressFilter不匹配,無法在接收方處理To'http:// localhost:8080/MaestroService/mex/mex'的消息。檢查發件人和收件人的EndpointAddresses是否同意。如果我弄清楚,我會更新這個問題。
更新V2
我去同一個解決方案中的另一個項目。我能夠在那裏添加服務,沒有任何問題。我注意到我在wpf瀏覽器應用程序中的控制檯應用程序中使用3.5版本。當我回來報告這個時,我注意到在我的最新更新中,即使我將http://localhost:8080/MaestroService/mex放入了url中,它仍然有/ mex/mex。我試過http://localhost:8080/MaestroService,它工作!
最後,我最終使用了Migual Castro技術here,在那裏創建了conracts和代理。很高興看到它是如何工作的以及VS在做什麼。但是,一天半之後回來是件好事。
感謝大家的建議。
「我不認爲我改變了任何配置。」 - 這通常是事情停止工作的原因.... – 2011-04-14 14:20:28
@Mitch。嚴。 :(我儘量不要觸摸它,但我不能100%肯定,但我知道我沒有碰到生產副本的配置,我得到的結果相同 – H20rider 2011-04-14 15:27:08