C# WCF 错误 - 没有端点侦听
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17572500/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
WCF error - There was no endpoint listening at
提问by Neil Hung
I am developing a WCF service, running IIS6 on Window server 2003. I have built a test client to talk to the WCF service and I am getting the error below. I have been looking at this error for days and went through people's suggestions on forums, but with no luck. Any help would be appreciated, many thanks
我正在开发 WCF 服务,在 Window server 2003 上运行 IIS6。我已经构建了一个测试客户端来与 WCF 服务对话,但出现以下错误。几天来我一直在查看这个错误,并在论坛上浏览了人们的建议,但没有运气。任何帮助将不胜感激,非常感谢
There was no endpoint listening at https://webbooking.infodata.uk.com/Synxis/Synxis.svcthat could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
https://webbooking.infodata.uk.com/Synxis/Synxis.svc上没有端点侦听 可以接受消息。这通常是由不正确的地址或 SOAP 操作引起的。有关更多详细信息,请参阅 InnerException(如果存在)。
System.Net.WebException: The remote server returned an error: (404) Not Found.
at System.Net.HttpWebRequest.GetResponse()
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
Server stack trace:
at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at IOta2010A.ReservationSynch_SubmitRequest(ReservationSynchRequest request)
at Ota2010AClient.IOta2010A.ReservationSynch_SubmitRequest(ReservationSynchRequest request) in c:\Development\WorkingFolder\Webservices\SynxisNew\App_Code\OTA2010A.cs:line 57589
at Ota2010AClient.ReservationSynch_SubmitRequest(Security Security, DateTime& TimeStamp, String CorrelationID, String RelatesToCorrelationID, ReplyTo ReplyTo, OTA_HotelResNotifRQ OTA_HotelResNotifRQ) in c:\Development\WorkingFolder\Webservices\SynxisNew\App_Code\OTA2010A.cs:line 57601
at Update.Page_Load(Object sender, EventArgs e) in c:\Development\WorkingFolder\Webservices\SynxisNew\Update.aspx.cs:line 72
Client config
客户端配置
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<compilation debug="true"/>
</system.web>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="ota2010AEndpoint" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false"
transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Transport">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
establishSecurityContext="true" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="https://webbooking.infodata.uk.com/synxis/synxis.svc"
binding="wsHttpBinding" bindingConfiguration="ota2010AEndpoint"
contract="IOta2010A" name="ota2010AEndpoint" />
</client>
</system.serviceModel>
</configuration>
Service config
服务配置
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="Pervasive.Data.SqlClient, Version=2.10.0.34, Culture=neutral, PublicKeyToken=C84CD5C63851E072"/>
</assemblies>
</compilation>
<authentication mode="Windows"/>
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
</system.web>
<system.serviceModel>
<services>
<service name="Synxis" behaviorConfiguration="SynxisWCF">
<endpoint address="" name="wsHttpEndpoint" binding="wsHttpBinding" contract="Synxis" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<diagnostics>
<messageLogging logEntireMessage="true" logMalformedMessages="true"
logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true"
maxMessagesToLog="300" />
</diagnostics>
<behaviors>
<serviceBehaviors>
<behavior name="SynxisWCF" >
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" externalMetadataLocation="https://webbooking.infodata.uk.com/synxis/Synxis.svc.wsdl" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
采纳答案by Tim
You do not define a binding in your service's config, so you are getting the default values for wsHttpBinding, and the default value for securityMode\transportfor that binding is Message.
您没有在服务的配置中定义绑定,因此您将获得 的默认值wsHttpBinding,而该securityMode\transport绑定的默认值为Message。
Try copying your binding configuration from the client's config to your service config and assign that binding to the endpoint via the bindingConfigurationattribute:
尝试将您的绑定配置从客户端的配置复制到您的服务配置,并通过bindingConfiguration属性将该绑定分配给端点:
<bindings>
<wsHttpBinding>
<binding name="ota2010AEndpoint"
.......>
<readerQuotas maxDepth="32" ... />
<reliableSession ordered="true" .... />
<security mode="Transport">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
establishSecurityContext="true" />
</security>
</binding>
</wsHttpBinding>
</bindings>
(Snipped parts of the config to save space in the answer).
(剪切部分配置以节省答案中的空间)。
<service name="Synxis" behaviorConfiguration="SynxisWCF">
<endpoint address="" name="wsHttpEndpoint"
binding="wsHttpBinding"
bindingConfiguration="ota2010AEndpoint"
contract="Synxis" />
This will then assign your defined binding (with Transport security) to the endpoint.
然后,这会将您定义的绑定(具有传输安全性)分配给端点。
回答by patricgh
I had the same issue. For me I noticed that the https is using another Certificate which was invalid in terms of expiration date. Not sure why it happened. I changed the Https port number and a new self signed cert. WCFtestClinet could connect to the server via HTTPS!
我遇到过同样的问题。对我来说,我注意到 https 正在使用另一个在到期日期方面无效的证书。不知道为什么会这样。我更改了 Https 端口号和一个新的自签名证书。WCFtestClinet 可以通过 HTTPS 连接到服务器!
回答by Atta H.
I was getting the same error with a service access. It was working in browser, but wasnt working when I try to access it in my asp.net/c# application. I changed application pool from appPoolIdentity to NetworkService, and it start working. Seems like a permission issue to me.
我在访问服务时遇到了同样的错误。它在浏览器中工作,但是当我尝试在我的 asp.net/c# 应用程序中访问它时没有工作。我将应用程序池从 appPoolIdentity 更改为 NetworkService,它开始工作。对我来说似乎是一个许可问题。
回答by Basheer AL-MOMANI
in my case
就我而言
my service has function to Upload Files
我的服务具有以下功能 Upload Files
and this error just shown up on trying to upload Big Files
这个错误只是在尝试上传时出现 Big Files
so I found this answerto Increase maxRequestLengthto needed value in web.config
所以我找到了这个答案来增加maxRequestLength所需的价值web.config
and problem solved
并解决了问题
if you don't make any upload or download operations maybe this answer will not help you
如果您不进行任何上传或下载操作,则此答案可能对您没有帮助
回答by Usman Younas
Different case but may help someone,
不同的情况,但可能会帮助某人,
In my case Window firewall was enabled on Server,
在我的情况下,服务器上启用了 Window 防火墙,
Two thinks can be done,
两个想法可以做到,
1) Disable windows firewall (your on risk but it will get thing work)
1)禁用Windows防火墙(您有风险,但它会起作用)
2) Add port in inbound rule.
2) 在入站规则中添加端口。
Thanks .
谢谢 。
回答by aseman arabsorkhi
You can solve the issue by clearing value of address in endpoint tag in web.config:
您可以通过清除 web.config 中端点标记中的地址值来解决此问题:
<endpoint address="" name="wsHttpEndpoint" ....... />

