我创建了一个WCFLibrary:
[OperationContract]
string TestCall();
我的app.config有这个:
<endpoint address="" binding="wsHttpBinding" contract="TestWCF.ITestService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8732/Design_Time_Addresses/TestWCF/TestService/" />
</baseAddresses>
</host>
我的Windows服务有这个:
protected override void OnStart(string[] args)
{
host = new ServiceHost(typeof(TestWCF.TestService));
}
编译了exe并将其作为服务安装到目前为止一切正常。
现在我想从浏览器中检查这个网址:
*http://localhost:8732/Design_Time_Addresses/TestWCF/TestService*
但由于某些原因我无法调用我在Windows服务中托管的WCF,可能会出现什么问题我错过了什么?
答案 0 :(得分:2)
protected override void OnStart(string[] args)
{
host = new ServiceHost(typeof(TestWCF.TestService));
host.Open(); // :-)
}