【发布时间】:2016-11-13 18:08:33
【问题描述】:
我在使用 localhost:8733 在浏览器中打开 WCF 服务时遇到问题。它说无法访问此站点
localhost 拒绝连接。
在 Google 上搜索本地主机 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())
【问题讨论】:
-
试试this
-
它对我不起作用
标签: wcf wcf-binding wcf-security