Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/296.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 服务运行后添加服务引用失败_C#_Wcf - Fatal编程技术网

C# 服务运行后添加服务引用失败

C# 服务运行后添加服务引用失败,c#,wcf,C#,Wcf,我尝试使用TCP在Windows服务中承载WCF,使用本文: 在所有成功通过的步骤包括运行服务后,我尝试向客户端添加WCF服务引用,因此我创建了console应用程序项目,在尝试向我的服务添加引用后,我出现以下错误: The URI prefix is not recognized. Metadata contains a reference that cannot be resolved: 'net.tcp://localhost:8523/Service1'. Could not conn

我尝试使用TCP在Windows服务中承载WCF,使用本文:

在所有成功通过的步骤包括运行服务后,我尝试向客户端添加WCF服务引用,因此我创建了console应用程序项目,在尝试向我的服务添加引用后,我出现以下错误:

The URI prefix is not recognized.
Metadata contains a reference that cannot be resolved: 'net.tcp://localhost:8523/Service1'.
Could not connect to net.tcp://localhost:8523/Service1. The connection attempt lasted for a time span of 00:00:02.0072566. TCP error code 10061: No connection could be made because the target machine actively refused it 127.0.0.1:8523. 
No connection could be made because the target machine actively refused it 127.0.0.1:8523
If the service is defined in the current solution, try building the solution and adding the service reference again.
这是我的app.config:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>

  <system.web>
    <compilation debug="true" />
  </system.web>
  <!-- When deploying the service library project, the content of the config file must be added to the host's 
  app.config file. System.Configuration does not support config files for libraries. -->
  <system.serviceModel>
    <services>
      <service name="WcfServiceLibrary1.Service1">
        <endpoint address="" binding="netTcpBinding" bindingConfiguration=""
          contract="WcfServiceLibrary1.IService1">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexTcpBinding" bindingConfiguration=""
          contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="net.tcp://localhost:8523/Service1" />
          </baseAddresses>
        </host>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="">
          <serviceMetadata httpGetEnabled="false" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>

</configuration>


我还尝试了
netstat-ap tcp
,但找不到我的服务连接操作

如何运行服务器,在什么操作系统上运行?Windows 8 x64,我从服务运行。msc服务启动时是否没有任何错误/异常?我这么问是因为我怀疑网络监听权限有问题。例如,考虑这个链接:我没有看到任何错误,你可以试试这个命令:<代码> NETSH http添加urrl URL=http://+:[你的端口号] / [你的URI]用户= [你的域] \ [你的用户]侦听=是/ <代码>?代码>[您的域]和
[您的用户]
应与运行服务的用户匹配。