我想編程設置WCF連接的終點。WCF:編程設置端點
我還沒有能夠,下面是我使用的代碼有人幫助識別出了什麼問題?
Uri wsBaseAddress = new Uri("http://localhost:27198/");
ServiceHost host = new ServiceHost(typeof(ServiceClient), wsBaseAddress);
WSHttpBinding wshttpbinding = new WSHttpBinding();
host.AddServiceEndpoint(typeof(IService), wshttpbinding, "ServiceClient");
host.AddServiceEndpoint(typeof(IService), wshttpbinding,
"http://localhost:27198/Service.svc");
host.Open();
編輯:
Error: HTTP could not register URL "http://+:27198/" because TCP port 27198 is being used by another application."
謝謝
什麼是不工作?你有錯誤嗎? – cadrell0
@ cadrell0對不起,請參閱我的編輯。我真的不明白爲什麼錯誤正在發生。 – user101010101