【问题标题】:WCF Service hosting in IIS and accessing it using Static IP在 IIS 中托管 WCF 服务并使用静态 IP 访问它
【发布时间】:2016-01-29 12:39:17
【问题描述】:

我在 IIS 中托管 WCF 服务,它在单个系统上运行良好,但是当我尝试使用远程机器(我的系统具有静态 ip)访问它时,它会询问我用户名和密码, 当我使用计算机凭据提供时,它不接受它 图 1 显示了该图,

<?xml version="1.0"?>

<bindings>
  <basicHttpBinding>
    <binding name="Service1Soap">
      <security mode="TransportCredentialOnly">
        <transport clientCredentialType="Ntlm" proxyCredentialType="None"
            realm=""/>
        <message clientCredentialType="UserName" algorithmSuite="Default"/>
      </security>
    </binding>
  </basicHttpBinding>
</bindings>
 <services>
   <service name="WCF_Static.WCF_Service" behaviorConfiguration="maxBehaviour">
    <endpoint address="staticip" binding="basicHttpBinding" contract="WCF_Static.IWCF_Service" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost/8080"/>
      </baseAddresses>
    </host>
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="maxBehaviour">
      <serviceMetadata httpGetEnabled="true"/>
    </behavior>
  </serviceBehaviors>
</behaviors>

在我使用的客户端代理上

    <?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
    </startup>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="BasicHttpBinding_IWCF_Service" />
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://123.123.123.123/Alias/Service.svc/staticip"  
                binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IWCF_Service"
                contract="ServiceReference1.IWCF_Service" name="BasicHttpBinding_IWCF_Service" />
        </client>
    </system.serviceModel>
</configuration>

参考链接here 谢谢,

【问题讨论】:

    标签: performance wcf wcf-data-services wcf-binding wcf-security


    【解决方案1】:

    找到了! ! :)

    在 IIS 中将服务部署为 http://localhost/abc/Service1.svc?wsdl 或 (http://127.0.0.1/abc/Service1.svc?wsdl),在客户端将服务引用添加为 @ 987654323@http://127.0.0.1/abc/Service1.svc?wsdl ,

    但在客户端的 appconfig 中

    将 localhost 或 127.0.0.1 更改为实际运行 WCF 服务的 IP 地址。 在这样的端点中

    端点地址="http://123.123.123.123/max/Service.svc/static"

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-12-13
      • 2011-03-21
      • 1970-01-01
      • 2020-04-26
      • 1970-01-01
      • 2011-07-26
      • 1970-01-01
      相关资源
      最近更新 更多