【问题标题】:localhost refused to connect本地主机拒绝连接
【发布时间】: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


【解决方案1】:

第二天早上在办公室,当我打开项目时,同样的问题出现了 - “无法访问此站点”。根据我之前对此问题的经验,我更改了端口号并开始工作。但这一次,它没有帮助。然后我尝试了另一种方法(见下面的截图)。

一个问题:

解决方案:

这是对我有用的另一种方式。我希望这会对面临同样问题的人有所帮助。

【讨论】:

  • 我想这个错误有很多原因,这不是万能的,但它确实解决了我遇到的问题,并让我从第 3 天拔掉头发而不是为什么 1服务神秘地停止运行。谢谢!
猜你喜欢
  • 2016-08-25
  • 1970-01-01
  • 2015-07-30
  • 1970-01-01
  • 1970-01-01
  • 2023-01-19
  • 2013-07-08
  • 2012-05-25
  • 2020-03-14
相关资源
最近更新 更多