1

WCF サービスを作成し、Windows サービスでホストしました。Visual Studio でこのサービスをテストすると問題なく動作し、使用することができます。ここで、サービスを PC (PC1 と呼ばれる) にインストールし、別の PC (PC2 と呼ばれる) を使用して、それを検出して使用できるようにしたいと考えています。これを実現するには、app.config ファイルを変更する必要があると思います。

これが現在の app.config です。これを他のネットワーク コンピューターから機能させるには、何を変更する必要がありますか? ベースアドレスが始まりだと思いますか?

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

<appSettings>
  <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<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="WcfAVOLibrary.AVOs">
    <endpoint address="" binding="wsDualHttpBinding" contract="WcfAVOLibrary.IAVOs">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:8733/Design_Time_Addresses/WcfAVOLibrary/AVOs/" />
      </baseAddresses>
    </host>
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior>
      <!-- To avoid disclosing metadata information, 
      set the values below to false before deployment -->
      <serviceMetadata httpGetEnabled="True"/>
      <!-- To receive exception details in faults for debugging purposes, 
      set the value below to true.  Set to false before deployment 
      to avoid disclosing exception information -->
      <serviceDebug includeExceptionDetailInFaults="False" />
    </behavior>
  </serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>

ああ、私は.Net 4.5を実行しています

4

3 に答える 3

0

次の場所で web.config を変更してみてください。

  <baseAddresses>
    <add baseAddress="http://192.168.1.2/Design_Time_Addresses/WcfAVOLibrary/AVOs/" />
  </baseAddresses>

192.168.1.2 が現在の IP である場合、または localhost も機能する場合、次のように表示されます。

  <baseAddresses>
    <add baseAddress="http://localhost/Design_Time_Addresses/WcfAVOLibrary/AVOs/" />
  </baseAddresses>
于 2013-04-17T14:48:03.830 に答える