4

HTTPで動作するnettcpを使用するSilverlight4.0アプリケーションがあります。次に、httpからhttpsに切り替えようとしました。これは私が問題にぶつかり始めたところです。アプリケーションを実行すると、Internet Explorerの通知「混合コンテンツを表示しますか?」が表示されます。[はい]をクリックすると、アプリケーションでエラーが発生します。

Could not connect to net.tcp://ServerName:4502/TestService.svc/netTcp. The connection attempt lasted for a time span of 00:00:01.2191219. TCP error code 10013: An attempt was made to access a socket in a way forbidden by its access permissions.. This could be due to attempting to access a service in a cross-domain way while the service is not configured for cross-domain access. You may need to contact the owner of the service to expose a sockets cross-domain policy over HTTP and host the service in the allowed sockets port range 4502-4534.

ClientConfigは次のとおりです。

    <configuration>
  <system.serviceModel>
    <bindings>
      <customBinding>
        <binding name="NetTcpBinding_ITestService">
          <binaryMessageEncoding />
          <tcpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
        </binding>
      </customBinding>
    </bindings>
    <client>
      <endpoint address="net.tcp://ServerName:4502/TestService.svc/netTcp"
        binding="customBinding" bindingConfiguration="NetTcpBinding_ITestService"
        contract="TestServer.ITestService" name="NetTcpBinding_ITestService"/>
    </client>
  </system.serviceModel>
</configuration>
 

私のWeb.configは次のとおりです。

 <netTcpBinding>
      <binding name="netTcpBindingConfig">
        <security mode="None" />
      </binding>
    </netTcpBinding>

  </bindings>
  <services>
    <service name="TestService">
      <endpoint address="netTcp" binding="netTcpBinding" bindingConfiguration="netTcpBindingConfig" contract="ITestService" />
      <endpoint address="mex" binding="mexHttpsBinding" name="mex" contract="IMetadataExchange" />
      <host>
      <baseAddresses>
        <add baseAddress="net.tcp://ServerName:4502/TestService.svc" />
        <add baseAddress="https://ServerName/TestService.svc" />
      </baseAddresses>
      </host>
    </service>
  </services>
     

サーバーのルートに、次のファイルがありますclientaccesspolicy.xml

<?xml version="1.0" encoding="utf-8"?>
<access-policy>
  <cross-domain-access>
    <policy>
      <allow-from http-request-headers="*">
          <domain uri="http://*"/>
          <domain uri="https://*"/>
      </allow-from>
      <grant-to>
        <resource path="/" include-subpaths="true" />
        <socket-resource port="4502-4530" protocol="tcp" />
      </grant-to>
    </policy>
  </cross-domain-access>
</access-policy>

nettcp通信は安全である必要はありませんが、アプリケーション内の他のサービスにはセキュリティが必要です。HTTPSでホストされているアプリケーションでnettcpを実行することは可能ですか?

4

0 に答える 0