2011-04-14 99 views
0

我的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在做什么。但是,一天半之后回来是件好事。

感谢大家的建议。

+0

“我不认为我改变了任何配置。” - 这通常是事情停止工作的原因.... – 2011-04-14 14:20:28

+0

@Mitch。严。 :(我尽量不要触摸它,但我不能100%肯定,但我知道我没有碰到生产副本的配置,我得到的结果相同 – H20rider 2011-04-14 15:27:08

回答

0

您正在作为Windows服务运行。

Windows服务在用户帐户的安全上下文中运行。

如果用户帐户的密码更改或过期,则该服务不会运行。

您应该检查的第一件事是:服务是否正在运行。

+0

该服务正在运行。如果不是,我会得到在添加引用之后:无法连接到远程服务器并且在IE中没有响应 – H20rider 2011-04-14 18:15:46

+0

它是否是空绑定配置? – 2011-04-14 21:31:08

+0

我放弃了试图弄清楚为什么突然之间我无法添加服务引用。我结束了以下使用的技术http://www.dnrtv.com/default.aspx?showNum=122。它看起来像一个更清洁的实现,然后添加服务参考 – H20rider 2011-04-18 21:09:49