我知道这个问题有很多帖子,我尝试了大多数的解决方案,但似乎没有任何效果。
我有一个WCF服务,当在IIS上托管时,它在开发框中工作正常,我将其移动到UAT盒应用服务器,我能够访问它并测试是否来自测试客户端。所以我现在在Web服务器上托管我的MVC应用程序,从Web服务器浏览器我可以访问该服务但是当我运行使用该服务的Web应用程序时,它会抛出以下错误。
Error Detail:- There was no endpoint listening at http://servername/AC.IS.BLService/CustService
.svc that could accept the message. This is often caused by an incorrect
address or SOAP action. See InnerException, if present, for more details.
Error TargetSite:- ACL.IS.BLWebSite.ViewModels.HomeAccountStatusViewModel
ValidateLogin(ACL.IS.BLWebSite.ViewModels.HomeAccountStatusViewModel)
Inner Exception:- System.Net.WebException: The remote server returned an
error: (404) Not Found. at System.Net.HttpWebRequest.GetResponse() at
System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannel
Request.WaitForReply(TimeSpan timeout)
所以,我尝试在同一台服务器上同时托管服务和Web应用程序,但我仍然遇到同样的问题。以下是服务和客户端的配置文件
Client.config
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_ICustomerService" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://servername/ACL.IS.BLService/CustService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ICustService"
contract="BLService.ICustService" name="BasicHttpBinding_ICustService" />
</client>
</system.serviceModel>
服务器配置
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_ICustService" />
</basicHttpBinding>
</bindings>
<services>
<service name="ACL.IS.BL_WebServices.CustService" behaviorConfiguration="mexBehavior">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8080/"/>
</baseAddresses>
</host>
<endpoint address="CustService" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ICustService" contract="ACL.IS.BL_WebServices.ICustService">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="mexBehavior">
<!-- To avoid disclosing metadata information,
set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="True" httpsGetEnabled="True"/>
<!-- To receive exception details in faults for debugging purposes,
set the value below to true. Set to false before deployment
to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="false"
multipleSiteBindingsEnabled="true" />
</system.serviceModel>
它是一个Windows 2012服务器。 IIS 8.5。有人可以帮忙。
只是提到..还有一个防火墙..它是否与端口号有关?
答案 0 :(得分:0)
您似乎合同不匹配。
客户端;
contract="BLService.ICustService"
服务器;
contract="ACL.IS.BL_WebServices.ICustService"
这些需要匹配
答案 1 :(得分:0)
您的服务器配置说它侦听端口8080:
baseAddress="http://localhost:8080/"
客户端连接到端口80时:
address="http://servername/ACL.IS.BLService/CustService.svc"
我认为他们应该匹配。