2011-07-14 82 views
1

我想在共享主机服务器上访问我的WCF服务,但我可以使用该服务,但是当我尝试调用该服务时,我收到“调用方未通过服务进行身份验证”错误。共享提供商上的主机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> 

有人知道如何解决这一问题?谢谢。

+0

大多数共享主机服务不支持net.tcp(防火墙限制)。 somee.com可能不太好。如果是这种情况,那么你必须改变你的绑定来使用基于HTTP的绑定。 – carlosfigueira

+0

好吧,我已经将它更改为wsDualHttpBinding,并且我可以在服务器上看到该服务,并且可以对其进行调用,但是当我尝试访问它时,我仍然接受调用程序未通过服务错误进行身份验证。我编辑我的问题是关于这个新问题。 – Lost

+0

PS:我现在已将客户端的安全模式更改为“无”,因此服务位于不同的网络上,因此Windows凭据无法工作。我也删除了身份,现在我得到一个超时错误或一个没有端点是听错误。我不知道我做了什么帮助或伤害,但它似乎合乎逻辑。 – Lost

回答

0

我在共享提供程序中的IIS中承载了我的WCF服务时出现同样的错误。显然WCF不支持部分受信任的呼叫者。我的解决方案是在WCF服务的Web配置文件的标签中添加一个信任声明。之后一切都很好。

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

我现在得到此操作没有在分配的超时期限内完成。 – Lost