Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/333.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# 同时托管多个WCF服务-它们共享服务名称_C#_Wcf_Localhost - Fatal编程技术网

C# 同时托管多个WCF服务-它们共享服务名称

C# 同时托管多个WCF服务-它们共享服务名称,c#,wcf,localhost,C#,Wcf,Localhost,我有一个WCF服务库项目,其中我有两个具有[ServiceContract]属性的类 我有一个控制台应用程序,它将承载这两个服务 代码: 现在,当我通过URI访问这两个服务地址时,它们都被标记为“存储服务”,并且在生成的代码中都有以下代码行: StorageClient client = new StorageClient(); 检索服务应该是RetrieveClient吗 app.config: <?xml version="1.0" encoding="utf-8" ?> &l

我有一个WCF服务库项目,其中我有两个具有[ServiceContract]属性的类

我有一个控制台应用程序,它将承载这两个服务

代码:

现在,当我通过URI访问这两个服务地址时,它们都被标记为“存储服务”,并且在生成的代码中都有以下代码行:

StorageClient client = new StorageClient();
检索服务应该是RetrieveClient吗

app.config

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.serviceModel>
    <services>
      <service name="NS.Retrieve">
        <endpoint address="" binding="basicHttpBinding" contract="NS.IRetrieve">
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8733/Design_Time_Addresses/NS/Retrieve/"/>
          </baseAddresses>
        </host>
      </service>
      <service name="NS.Storage">
        <endpoint address="" binding="basicHttpBinding" contract="NS.IStorage">
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8733/Design_Time_Addresses/NS/Storage/"/>
          </baseAddresses>
        </host>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <serviceMetadata httpGetEnabled="True" httpsGetEnabled="True"/>
          <serviceDebug includeExceptionDetailInFaults="False" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
</configuration>

如果是WCF,则是配置问题。请发布整个web.config(服务器和客户端)。app.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.serviceModel>
    <services>
      <service name="NS.Retrieve">
        <endpoint address="" binding="basicHttpBinding" contract="NS.IRetrieve">
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8733/Design_Time_Addresses/NS/Retrieve/"/>
          </baseAddresses>
        </host>
      </service>
      <service name="NS.Storage">
        <endpoint address="" binding="basicHttpBinding" contract="NS.IStorage">
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8733/Design_Time_Addresses/NS/Storage/"/>
          </baseAddresses>
        </host>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <serviceMetadata httpGetEnabled="True" httpsGetEnabled="True"/>
          <serviceDebug includeExceptionDetailInFaults="False" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
</configuration>