我在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>
refereed links here谢谢,
找到了! ! :)
在IIS中将服务部署为http://localhost/abc/Service1.svc?wsdl或(http://127.0.0.1/abc/Service1.svc?wsdl),在客户端将服务引用添加为http://localhost/abc/Service1.svc?wsdl或http://127.0.0.1/abc/Service1.svc?wsdl,
但在客户端的appconfig中
将localhost或127.0.0.1更改为运行实际WCF服务的IP地址。在这样的端点
endpoint address =“http://123.123.123.123/max/Service.svc/static”