C# 无法连接到WCF服务。缺少端点元素
我正在尝试创建自己的WCF服务和客户端。我已使用以下app.config设置创建了我的服务:C# 无法连接到WCF服务。缺少端点元素,c#,wcf,channelfactory,C#,Wcf,Channelfactory,我正在尝试创建自己的WCF服务和客户端。我已使用以下app.config设置创建了我的服务: <system.serviceModel> <services> <service name="Interface.MyWCFService"> <endpoint address="http://localhost:9999/MyService" binding="basicHttpBinding"
<system.serviceModel>
<services>
<service name="Interface.MyWCFService">
<endpoint address="http://localhost:9999/MyService" binding="basicHttpBinding"
bindingConfiguration="" name="MyServiceEndpoint" contract="Interface.IMyWCFService" />
</service>
</services>
</system.serviceModel>
服务启动时没有异常
我的客户端应该连接到此服务。他的app.config是这样的:
以下是我配置服务的方式:
<service name="foo.bar.BlaService">
<host>
<baseAddresses>
<add baseAddress="http://localhost/BlaService" />
</baseAddresses>
</host>
<endpoint address="" binding="basicHttpBinding" contract="foo.bar.IBlaService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
这里是客户:
<client>
<endpoint name="BlaService" address="http://localhost/BlaService" binding="basicHttpBinding" contract="foo.bar.IBlaService" />
</client>
错误引用的是端点,而不是服务。OP的服务配置看起来是正确的,错误在客户端,而不是服务中。好的,既然错误定位在客户端,你知道吗?@Christoph,你试过我的建议了吗?在WCF中,某些设置必须在服务器和客户端之间同步…嘿,使用您的设置,服务将不再启动。打开servicehost时存在另一个异常。该服务没有应用程序endpoint@Christoph,只是描述了我平时的行为。这有用吗?我可以用这些设置创建一个频道。。。