[英]WCF - Service Reference not be created
我的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.
wsdl:portType的XPath://wsdl:definitions[@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
我去了同一个解决方案中的另一个项目。 我能够毫无问题地添加服务。 我注意到我在控制台应用程序中使用3.5,而在wpf浏览器应用程序中使用4.0。 当我回来报告此问题时,即使在URL中放置了http:// localhost:8080 / MaestroService / mex ,我在上次更新中也注意到它具有/ mex / mex。 我只是尝试http:// localhost:8080 / MaestroService而已!!!
最后,我确实在这里使用了Migual Castro技术,在其中创建了问题和代理。 很好看它是如何工作的以及VS在做什么。 但是那一天半回来会很好。
谢谢大家的建议。
您正在作为Windows服务运行。
Windows服务在用户帐户的安全上下文中运行。
如果用户帐户的密码更改或到期,则该服务将无法运行。
您应该检查的第一件事是:服务正在运行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.