我在使用localhost:8733在浏览器中打开WCF服务时遇到问题。它说无法访问此站点
localhost拒绝连接。
在Google上搜索localhost 8733 主页搜索航班 ERR_CONNECTION_REFUSED
以下是在托管应用程序的控制台应用程序中使用的配置文件
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="mex1">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="HelloIndigo.HelloIndigo" behaviorConfiguration="mex1">
<endpoint address="HelloIndigo" binding="basicHttpBinding" contract="HelloIndigo.IHelloIndigo">
</endpoint>
<endpoint address="HelloIndigo" binding="netTcpBinding" contract="HelloIndigo.IHelloIndigo"></endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8733/" />
<add baseAddress="net.tcp://localhost:9000"/>
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
</configuration>
在主机控制台应用程序中,我正在编写以下代码
ServiceHost host = new ServiceHost(typeof(HelloIndigo.HelloIndigo));
host.Open();
Console.WriteLine("Host is opened at " + DateTime.Now.ToString())