我正在从我的 Asp.net MVC Web 应用程序调用 Java Web 服务。如果 web.config 中的端点地址使用其 ip 地址或 localost 引用服务器,则 Web 服务工作。但是当我用主机名替换 ip adderess 时,它找不到服务器。
这是我的 web.config 的服务部分
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="TestInterfaceBeanServiceSoapBinding" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://MyServer:8080/ets-impl-2.0/TestInterfaceBean"
binding="basicHttpBinding" bindingConfiguration="TestInterfaceBeanServiceSoapBinding"
contract="TestService.TestInterfaceBean" name="TestInterfaceBeanPort" />
</client>
</system.serviceModel>