IIS托管服务的问题-本地和远程

问题描述 投票:0回答:1

我正在为当前正在研究的项目构建2个服务。

1)使用basicHttpBinding的简单客户端-服务器请求服务>

2)使用WSDualHttpBinding的回调数据服务

有些混乱,我既可以在IIS中进行托管,也可以在本地浏览器以及将与这两种服务都交互的另一台计算机上访问:/Service.svc。

这里是回调数据服务的app-config部分

    <system.serviceModel>
  <behaviors>
    <endpointBehaviors>
      <behavior name="myBehavior">
        <clientVia />
      </behavior>
    </endpointBehaviors>
  </behaviors>
  <bindings>
        <wsDualHttpBinding>
            <binding name="WSDualHttpBinding_IDataService">
              <security mode="None">
                <message negotiateServiceCredential="false" clientCredentialType="None" />
              </security>
            </binding>
          </wsDualHttpBinding>
    </bindings>
    <client>
        <endpoint address="http://<address>:50111/Service.svc/service"
            binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_IDataService" behaviorConfiguration="myBehavior"
            contract="CallbackService.IDataService" name="WSDualHttpBinding_IDataService">
        </endpoint>
    </client>
</system.serviceModel>

basicHttpBinding看起来很相似-仅在另一个端口上

我将IIS设置为匿名身份验证..用户IUSR,没有密码..

最初它在本地工作,但是我从远程计算机收到了身份验证错误..因此,我进行了一些调整-现在,即使在本地,我也遇到了超时..尽管Visual Studio与两个服务的服务引用都很好地交互。

如何再次获得“合作”的服务

而且我不知所措-非常感谢您的帮助!?

编辑:解决了第一个问题-恢复了本地通信

public ClientCallbacks myCallbacks=new ClientCallbacks();      
public DuplexChannelFactory<IDataService> channelFactory { get; set; }
public IDataService channel;

public int connect() {
    WSDualHttpBinding binding = new WSDualHttpBinding() 
        { Name = "WSDualHttpBinding_IDataService" };
    this.channelFactory = new DuplexChannelFactory<IDataService>(
        mainForm.dbCommunication.myCallbacks,
        binding,
        new EndpointAddress("http://<address>:50111/Service.svc/service"));
    this.channel = this.channelFactory.CreateChannel();
...
...
channel.AddListener(int-parameter); // announce new callback-partner
...
...
 this.newListe = this.myCallbacks.receivedTaskList; //get Tasklist over callback

这在本地有效-但是远程调用却收到“新”错误

System.ServiceModel.Security.SecurityNegotiationException:
  The caller was not authenticated by the service. ---> 
  System.ServiceModel.FaultException: The request for security token could not be satisfied
 because authentication failed.
   at System.ServiceModel.Security.SecurityUtils.ThrowIfNegotiationFault
    (Message message, EndpointAddress target)
at System.ServiceModel.Security.SspiNegotiationTokenProvider.GetNextOutgoingMessageBody
    (Message incomingMessage, SspiNegotiationTokenProviderState sspiState)
--- End of inner exception stack trace ---

再次,我很难找到一个线索/解决方案。我将IIS身份验证设置为匿名...但是似乎在达到该点之前通信已被阻止..从远程获取服务我该怎么办。机器?

我正在为当前正在研究的项目构建2个服务。 1)使用basicHttpBinding的简单客户端-服务器请求服务2)使用WSDualHttpBinding的回调数据服务,并带有一些搅动...

c# wcf iis visual-studio-2012
1个回答
0
投票

似乎我们应该提供凭据,以使客户端由服务器端进行身份验证。应提供哪种凭据取决于服务器端的绑定配置。默认情况下。 WsDualhttpbinding的安全模式配置为消息安全模式,并且客户端凭据类型为Windows。以下这些代码段是等效的。

© www.soinside.com 2019 - 2024. All rights reserved.