WCF http访问,localhost可以,但通过ip地址访问就不行。
做了一个wcf的程序,通过http访问,localhost可以正常访问,但换成ip地址就不行了。求指点,这是config的内容
防火墙已经关闭了
程序代码:
<?xml version="1.0" encoding="utf-8" ?> <configuration> <system.web> <compilation debug="true" /> </system.web> <!-- 部署服务库项目时,必须将配置文件的内容添加到 主机的 app.config 文件中。System.Configuration 不支持库的配置文件。--> <system.serviceModel> <bindings> <webHttpBinding> <binding name="HttpJsonBinding" crossDomainScriptAccessEnabled="true"/> </webHttpBinding> </bindings> <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true"/> <services> <service name="JsonServerDLL.JsonServer"> <endpoint address="" behaviorConfiguration="web" binding="webHttpBinding" bindingConfiguration="HttpJsonBinding" contract="JsonServerDLL.IJsonServer"> <identity> <dns value="localhost" /> </identity> </endpoint> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> <host> <baseAddresses> <add baseAddress="http://localhost:8736/JsonServer/" /> </baseAddresses> </host> </service> </services> <behaviors> <endpointBehaviors> <behavior name="web"> <webHttp helpEnabled="true" /> </behavior> </endpointBehaviors> <serviceBehaviors> <behavior> <!-- 为避免泄漏元数据信息, 请在部署前将以下值设置为 false 并删除上面的元数据终结点 --> <serviceMetadata httpGetEnabled="True"/> <!-- 要接收故障异常详细信息以进行调试, 请将以下值设置为 true。在部署前设置为 false 以避免泄漏异常信息--> <serviceDebug includeExceptionDetailInFaults="False" /> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel> </configuration>