共享提供程序上的主机WCF服务

时间:2011-07-14 15:38:31

标签: wcf http hosting net.tcp wcf-callbacks

我正在尝试在共享托管服务器上访问我的WCF服务,我可以使用该服务,但是当我尝试调用该服务时,我得到“调用者未被服务认证”错误。

客户端app.config

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.serviceModel>
        <bindings>
            <wsDualHttpBinding>
                <binding name="WSDualHttpBinding_TicketingService" clientBaseAddress="http://mmservice.somee.com:8001/MMService.Ticketing.svc" 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="IssuedToken" negotiateServiceCredential="true"
                            algorithmSuite="Default" />
                    </security>
                </binding>
            </wsDualHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://mmservice.somee.com/MMService.Ticketing.svc"
                binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_TicketingService"
                contract="MMService.TicketingService" name="WSDualHttpBinding_TicketingService">
                <identity>
                    <servicePrincipalName value="host/vb5100" />
                </identity>
            </endpoint>
        </client>
    </system.serviceModel>
</configuration>

服务app.config

<?xml version="1.0"?>
<configuration>
  <system.web>
    <compilation debug="true"/>
    <customErrors mode="Off"/>
  </system.web>
  <system.serviceModel>
    <client>

    </client>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="True"/>
    <services>
      <service behaviorConfiguration="MMService.Service1Behavior" name="MMService.Ticketing">
        <host>
          <baseAddresses>
            <add baseAddress = "http://localhost:8732/Design_Time_Addresses/MMService/Service1/"/>
          </baseAddresses>
        </host>
        <endpoint address ="" binding="wsDualHttpBinding" bindingConfiguration="" contract="MMService.ITicketService">

        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="MMService.Service1Behavior">
          <serviceMetadata httpGetEnabled="True"/>
          <serviceDebug includeExceptionDetailInFaults="False" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
</configuration>

有谁知道如何解决这个问题?感谢。

1 个答案:

答案 0 :(得分:0)

我在共享提供程序的IIS中托管的WCF服务遇到了同样的错误。显然,WCF不支持部分信任的呼叫者。我的解决方案是在WCF服务的Web配置文件的标记内添加信任声明。之后一切都很好。

<configuration>
  <system.web>
    <trust level="full"/>
    ...
  </system.web>
  ...
</configuration>