2

WPF アプリケーションを WCF クラス ライブラリに追加しました。WCF のアプリ構成は次のとおりです。

  <service name="WCFChatApplication.Service1">
    <host>
      <baseAddresses>
        <add baseAddress = "http://localhost:8732/Design_Time_Addresses/WCFChatApplication/Service1/" />
      </baseAddresses>
    </host>
    <!-- Service Endpoints -->
    <!-- Unless fully qualified, address is relative to base address supplied above -->
    <endpoint address ="" binding="wsDualHttpBinding" contract="WCFChatApplication.IMessageServiceInbound">
      <!-- 
          Upon deployment, the following identity element should be removed or replaced to reflect the 
          identity under which the deployed service runs.  If removed, WCF will infer an appropriate identity 
          automatically.
      -->
      <identity>
        <dns value="localhost"/>
      </identity>
    </endpoint>
    <!-- Metadata Endpoints -->
    <!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. --> 
    <!-- This endpoint does not use a secure binding and should be secured or removed before deployment -->
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
  </service>

私のWPFアプリcpnfigは

    <bindings>
        <wsDualHttpBinding>
            <binding name="WSDualHttpBinding_IMessageServiceInbound" closeTimeout="00:01:00"
                openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
                maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true">
                <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                <reliableSession ordered="true" inactivityTimeout="00:10:00" />
                <security mode="Message">
                    <message clientCredentialType="Windows" negotiateServiceCredential="true"
                        algorithmSuite="Default" />
                </security>
            </binding>
        </wsDualHttpBinding>
    </bindings>

でも電話したら

 ServiceReference1.MessageServiceInboundClient Sc1 = new ServiceReference1.MessageServiceInboundClient(new InstanceContext(this),"WSDualHttpBinding_IMessageServiceInbound");
            Sc1.Open();

私が得るエラーは

TCP ポート 80 が別のアプリケーションによって使用されているため、HTTP は URLhttp://+:80/Temporary_Listen_Addresses/9b1e11c2-0c91-43a6-9a17-26f473a9fdbc/ を登録できませんでした。

ポート 80 を使用するプロセスは Inetinfo.exe です。このプロセスを閉じることができないようです。

ポート 80 から他のポートに移動する方法はありますか?

ありがとう

4

3 に答える 3

0

スカイプを閉じます。ぼーや。同じ問題がありました。Skype ポートを変更できると考えてください。

http://forums.iis.net/t/1086489.aspx?IIS+Manager+Error+The+process+cannot+access+the+file+because+it+is+being+used+by+another+process+ Exception+from+HRESULT+0x80070020+

于 2016-05-10T13:21:19.997 に答える
0

私の推測では、Visual Studio が WCF サービスをホストしようとしており、これにより、アプリケーションによって行われるホスティングと競合が発生します。

WCF プロジェクトのプロパティを開きます。

[WCF オプション] タブを開きます。

最初のチェックボックスをオフにします (同じソリューションで別のプロジェクトをデバッグするときに WCF サービス ホストを開始します)。

于 2013-05-16T10:50:41.850 に答える