我正在托管WCF服务,但我遇到了错误。 [英] I am hosting WCF service but I am facing error.
问题描述
错误消息:
绑定实例已经与侦听URIhttp:// localhost:8080 / RemService相关联。如果两个端点想要共享相同的ListenUri,则它们还必须共享相同的绑定对象实例。两个冲突的端点在AddServiceEndpoint()调用,配置文件或AddServiceEndpoint()和config的组合中指定。
代码:
error message:
A binding instance has already been associated to listen URI 'http://localhost:8080/RemService'. If two endpoints want to share the same ListenUri, they must also share the same binding object instance. The two conflicting endpoints were either specified in AddServiceEndpoint() calls, in a config file, or a combination of AddServiceEndpoint() and config.
CODE :
using (System.ServiceModel.ServiceHost host = new System.ServiceModel.ServiceHost(typeof(REMService.REMServices)))
{
host.Open();
Console.WriteLine("Service Started at" + DateTime.Now);
Console.ReadLine();
}
我的尝试:
What I have tried:
<configuration>
<system.servicemodel>
<services>
<service name="REMService.REMServices" behaviorConfiguration="mexBehavior">
<endpoint name="basic" address="RemService" binding="basicHttpBinding" contract="REMService.IREMServices">
<endpoint address="RemService" binding="netHttpBinding" contract="REMService.IREMServices">
<endpoint name="mex" address="mex" binding="mexHttpBinding" contract="IMetadataExchange">
<host>
<baseaddresses>
<add baseAddress="http://localhost:8080/"/>
<add baseAddress="net.tcp://localhost:8090/"/>
<behaviors>
<servicebehaviors>
<behavior name="mexBehavior">
<serviceMetadata httpGetEnabled="true"/>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/>
推荐答案
<endpoint name="basic" address="RemService" binding="basicHttpBinding" contract="REMService.IREMServices">
<endpoint address="RemService" binding="netHttpBinding" contract="REMService.IREMServices">
这些到端点共享相同的地址 - 这是不可能的...更改地址其中之一或删除不必要的......
These to endpoints share the same address - it is impossible... change the address for one of them or remove the unnecessary...
这篇关于我正在托管WCF服务,但我遇到了错误。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!