问题描述
帮助我,我试图将服务引用添加到WCF服务托管在服务器上.
这是我用来尝试添加服务的网址参考
(当我在Internet Explorer中键入此url时,xml就会通过)
> 这是配置文件
This is the configuration file
> < system.serviceModel >
<system.serviceModel>
> < 服务 >
<services>
>
> < 服务 名称 = " MyService.MyService " 行为配置 = " Mex_MyService " >
<servicename="MyService.MyService " behaviorConfiguration="Mex_MyService">
> < 端点 地址 = " net.tcp://localhost/MyService "
<endpointaddress="net.tcp://localhost/MyService"
> 绑定 = " netTcpBinding ""
binding="netTcpBinding"
> bindingConfiguration = " tcpBinding ""
bindingConfiguration="tcpBinding"
> 合同 = " MyService.IMyService ""
contract="MyService.IMyService"
> />
/>
> </ 服务 >
</service>
> </ 服务 >
</services>
> < 绑定 >
<bindings>
> < netTcpBinding >
<netTcpBinding>
> < 绑定 名称 = " tcpBinding "" sendTimeout = " 00:02: 00 " receiveTimeout = " 00:02: 00 " transactionFlow = " true " portSharingEnabled = " true "
<bindingname="tcpBinding"sendTimeout="00:02:00"receiveTimeout="00:02:00"transactionFlow="true"portSharingEnabled="true"
> maxBufferPoolSize = " 67108864 " maxBufferSize = " 67108864 " maxReceivedMessageSize = " 67108864 " >
maxBufferPoolSize="67108864"maxBufferSize="67108864"maxReceivedMessageSize="67108864">
> < readerQuotas maxArrayLength = " 67108864 "" maxStringContentLength = " 67108864 " maxDepth = " 67108864 " />
<readerQuotasmaxArrayLength="67108864"maxStringContentLength="67108864"maxDepth ="67108864" />
> </ 绑定 >
</binding>
> </ netTcpBinding >
</netTcpBinding>
> </ 绑定 >
</bindings>
> < 行为 >
<behaviors>
> < serviceBehaviors >
<serviceBehaviors>
> < 行为 名称 = " Mex_MyService " >
<behaviorname="Mex_MyService">
> < serviceMetadata httpGetEnabled = " true " httpGetUrl = " http://本地主机:9001/MyService "> />
<serviceMetadatahttpGetEnabled="true"httpGetUrl="http://localhost:9001/MyService"/>
> < dataContractSerializer maxItemsInObjectGraph = " 67108864 "" />
<dataContractSerializermaxItemsInObjectGraph="67108864"/>
> </ 行为 >
</behavior>
> </ serviceBehaviors >
</serviceBehaviors>
> </ 行为 >
</behaviors>
</ system.serviceModel >
</system.serviceModel>
> 这是尝试引用此服务时的错误消息
This is the error message when trying to reference this service
该文档已被理解,但无法处理.
-WSDL文档包含无法解析的链接.
- The WSDL document contains links that could not be resolved.
-下载'http://localhost:9001/MyService?xsd = xsd0'时出错.
- There was an error downloading 'http://localhost:9001/MyService?xsd=xsd0'.
-无法连接到远程服务器
- Unable to connect to the remote server
-无法建立连接,因为目标计算机主动拒绝它127.0.0.1:9001
- No connection could be made because the target machine actively refused it 127.0.0.1:9001
元数据包含无法解析的引用:'http://MyServer:9001/MyService’.
没有端点在听 http://MyServer:9001/MyService 可以接受该消息.这通常是由不正确的地址或SOAP操作引起的.有关更多详细信息,请参见InnerException(如果存在).
There was no endpoint listening athttp://MyServer:9001/MyService that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
远程服务器返回错误:(404)未找到.
如果服务在当前解决方案中定义,请尝试构建解决方案并再次添加服务引用.
推荐答案
快速回复一下.
-您应该在net.tcp地址上设置端口号:net.tcp://localhost:9001/MyService.
- You should set the port number on the net.tcp address: net.tcp://localhost:9001/MyService.
-您不应在混合地址上设置端口号:http://localhost/MyService
- You should not set the port number on the mex address: http://localhost/MyService
我不确定这是否是解决方案,但这至少是合乎逻辑的事情:)
I'm not sure if this is the solution, but it's at least a logical thing to do:)
这篇关于尝试引用WCF服务时,没有端点在监听....的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!