无法连接到远程计算机上的IIS服务器

时间:2017-02-25 14:48:38

标签: c# asp.net wcf iis windows-server-2008-r2

我在remonte机器上创建了iis服务器(Windows Server 2008 R2)。这是我的web.config:

  <system.serviceModel>
<bindings>
  <wsHttpBinding>
    <binding name="Binding" closeTimeout="00:05:00" sendTimeout="00:10:00" />
  </wsHttpBinding>
</bindings>
<behaviors>
  <serviceBehaviors>
    <behavior name="DictionaryServiceBehaviors">
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
  </serviceBehaviors>
</behaviors>
<services>
  <service behaviorConfiguration="DictionaryServiceBehaviors" name="BandD.Serwis.SerwisISS.Service.DictionariesService">
    <endpoint address=""
              binding="wsHttpBinding"
              contract="BandD.Serwis.SerwisISS.Interface.IDictionariesService"
              bindingConfiguration="Binding"/>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
    <host>
      <baseAddresses>
        <add baseAddress="http://xxx.xxx.199.89:7833/BandD.Serwis.SerwisISS.Service/DictionariesService/"/>
      </baseAddresses>
    </host>
  </service>
</services>

这是客户端应用程序的app.config:

  <system.serviceModel>
<bindings>
  <wsHttpBinding>
    <binding name="WSHttpBinding_IDictionariesService" />
  </wsHttpBinding>
</bindings>
<client>
  <endpoint address="http://xxx.xxx.199.89:7833/Service/DictionariesService.svc"
      binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IDictionariesService"
      contract="DictionariesService.IDictionariesService" name="WSHttpBinding_IDictionariesService">
  </endpoint>
</client>

我已将IIS服务器角色添加到我的远程计算机,我设置物理路径以从服务器应用程序中找到publised文件(从VS发布)。我将所有身份验证设置为“已禁用”,仅启用“匿名身份验证”。

当我尝试使用SoapUi连接到WSDL时,我会出错:

Error getting response; java.net.UnknowsHostException: winserver2008

当我想用客户端应用程序连接到服务器时,我必须写用户名和密码(管理员密码不起作用)。 我必须做什么才能连接到服务器而无需身份验证。我应该在服务器(Windows服务器)或app.config上更改以正确连接。

可能我有床web / app.config

1 个答案:

答案 0 :(得分:0)

好的,我找到了解决方案: 在MS Server上我改为现在网站连接为(在贝司设置中)给管理员。这只是暂时的,我稍后会改变它。 其次我改变了服务器上的web.config:

  <system.serviceModel>
<bindings>
  <wsHttpBinding>
    <binding name="Binding" closeTimeout="00:05:00" sendTimeout="00:10:00">
      <security mode="None" />
      <reliableSession enabled="true" />
    </binding>
  </wsHttpBinding>
</bindings>
<behaviors>
  <serviceBehaviors>
    <behavior name="DictionaryServiceBehaviors">
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
  </serviceBehaviors>
</behaviors>
<services>
  <service behaviorConfiguration="DictionaryServiceBehaviors" name="BandD.Serwis.SerwisISS.Service.DictionariesService">
    <endpoint address="" binding="wsHttpBinding" bindingConfiguration="Binding"
      contract="BandD.Serwis.SerwisISS.Interface.IDictionariesService" />
    <endpoint address="mex" binding="mexHttpBinding" bindingConfiguration=""
      name="mex" contract="IMetadataExchange" />
    <host>
      <baseAddresses>
        <add baseAddress="http://http://xxx.xxx.199.89:7833/Service/DictionariesService" />
      </baseAddresses>
      <timeouts closeTimeout="00:01:00" openTimeout="00:10:00" />
    </host>
  </service>
</services>

最后我更改了客户端应用配置:

<system.serviceModel>
    <bindings>
        <wsHttpBinding>
            <binding name="WSHttpBinding_IDictionariesService">
                <reliableSession enabled="true" />
                <security mode="None" />
            </binding>
        </wsHttpBinding>
    </bindings>
    <client>
        <endpoint address="http://xxx.xxx.199.89:7833/Service/DictionariesService.svc"
            binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IDictionariesService"
            contract="DictionariesService.IDictionariesService" name="WSHttpBinding_IDictionariesService" />
    </client>
</system.serviceModel>