以前还好好的,近日突然有了这个问题,试了很多方法都没解决不知道各位有没有碰到过.拿一个简单的例子来说HOST端app.config
<service behaviorConfiguration="Host.HelloWCFServiceBehavior"
name="Host.HelloWCFService">
<endpoint address="" binding="basicHttpBinding" contract="Host.IHelloWCFService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:17521/HelloWCFService/" />
</baseAddresses>
</host>
</service>
然后program.cs里
class Program {
static void Main(string[] args)
{
using (ServiceHost host = new ServiceHost(typeof(Host.HelloWCFService))) {
host.Open(); //这里会产生个指定的网络格式名无效的错误.
Console.ReadLine();
}
}
}
还请哪位指点下!