Silverlight WCF服务部署设置

时间:2012-10-18 15:35:47

标签: silverlight

我一直在尝试使用WCF服务部署我的Silverlight应用程序,并在调用服务时不断收到通信错误。我希望大家看看我的配置文件,看看你们是否看到任何不合适的地方。我的WCF服务位于同一个项目中。

的Web.Config

<system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="PCCWITCGenerator.Web.Services.ITCGeneratorService.customBinding0"
                 closeTimeout="03:00:00"
                 openTimeout="03:00:00"
                 receiveTimeout="03:00:00"
                 sendTimeout="03:00:00">
        </binding>
      </basicHttpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior name="ITCGeneratorService">
          <serviceMetadata httpGetEnabled="True"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <services>
      <service behaviorConfiguration="ITCGeneratorService" name="ITCGeneratorService">
        <endpoint address="/ITCGeneratorService/"
                  binding="basicHttpBinding"
                  bindingConfiguration="PCCWITCGenerator.Web.Services.ITCGeneratorService.customBinding0"
                  contract="PCCWITCGenerator.Web.Services.ITCGeneratorService">
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
        <host>
          <baseAddresses>
            <add    baseAddress="http://localhost:38095/ITCGeneratorService/PCCWITCGenerator.Web.Services.ITCGeneratorService.svc"/>
          </baseAddresses>
        </host>
      </service>
    </services>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </system.serviceModel>

ServiceReferences.ClientConfig

<configuration>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="CustomBinding_ITCGeneratorService" closeTimeout="03:00:00"
                    openTimeout="03:00:00" receiveTimeout="03:00:00" sendTimeout="03:00:00"
                    maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"/>
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://10.30.20.58:38095/ITCGeneratorService/PCCWITCGenerator.Web.Services.ITCGeneratorService.svc"
                binding="basicHttpBinding" bindingConfiguration="CustomBinding_ITCGeneratorService"
                contract="ITCGeneratorServiceReference.ITCGeneratorService"
                name="CustomBinding_ITCGeneratorService" />
        </client>
    </system.serviceModel>
</configuration>

clientaccesspolicy.xml

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

0 个答案:

没有答案