WCF错误 - 没有端点正在侦听

时间:2013-07-10 13:53:35

标签: c# wcf

我正在开发一个WCF服务,在Window server 2003上运行IIS6。我已经构建了一个测试客户端来与WCF服务进行通信,我收到以下错误。我一直在看这个错误几天,并在论坛上通过了人们的建议,但没有运气。任何帮助将不胜感激,非常感谢

  

没有终点收听   可以接受的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

客户端配置

<?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>

服务配置

<?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>

6 个答案:

答案 0 :(得分:14)

您没有在服务的配置中定义绑定,因此您将获得wsHttpBinding的默认值,并且该绑定的securityMode\transport的默认值为Message

尝试将绑定配置从客户端配置复制到服务配置,并通过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>    

(剪辑的配置部分以节省答案中的空间)。

<service name="Synxis" behaviorConfiguration="SynxisWCF">
    <endpoint address="" name="wsHttpEndpoint" 
              binding="wsHttpBinding" 
              bindingConfiguration="ota2010AEndpoint"
              contract="Synxis" />

然后,这将为您定义的绑定(使用传输安全性)分配给端点。

答案 1 :(得分:2)

我有同样的问题。对我来说,我注意到https正在使用另一个证书,该证书在到期日期方面无效。不知道为什么会这样。我更改了Https端口号和一个新的自签名证书。 WCFtestClinet可以通过HTTPS连接到服务器!

答案 2 :(得分:1)

在我的情况下

我的服务具有Upload Files

的功能

并且在尝试上传Big Files

时出现此错误

所以我发现this answermaxRequestLength

web.config增加到所需的值

问题解决了

如果您不进行任何上传或下载操作,这个答案可能无法帮助您

答案 3 :(得分:1)

不同的情况但可能对某人有帮助,

在我的案例中,在服务器上启用了窗口防火墙,

可以做两个想法,

1)禁用Windows防火墙(你的风险,但它会让事情有效)

2)在入站规则中添加端口。

谢谢。

答案 4 :(得分:0)

我在服务访问时遇到了同样的错误。它在浏览器中工作,但是当我尝试在我的asp.net/c#应用程序中访问它时它没有工作。我将应用程序池从appPoolIdentity更改为NetworkService,然后开始工作。对我来说似乎是一个许可问题。

答案 5 :(得分:0)

您可以通过清除web.config中端点标记中的address值来解决此问题:

19/01/07 13:34:55 ERROR MicroBatchExecution: Query [id = 03fdd202-d795-4f69-ad8d-e712568e3d88, runId = 03dd8e92-ffee-414d-99a1-f43a819630dd] terminated with error
java.lang.IllegalArgumentException
        at org.apache.xbean.asm5.ClassReader.<init>(Unknown Source)
        at org.apache.xbean.asm5.ClassReader.<init>(Unknown Source)
        at org.apache.xbean.asm5.ClassReader.<init>(Unknown Source)
        at org.apache.spark.util.ClosureCleaner$.getClassReader(ClosureCleaner.scala:46)
        at org.apache.spark.util.FieldAccessFinder$$anon$3$$anonfun$visitMethodInsn$2.apply(ClosureCleaner.scala:449)
        at org.apache.spark.util.FieldAccessFinder$$anon$3$$anonfun$visitMethodInsn$2.apply(ClosureCleaner.scala:432)
        at scala.collection.TraversableLike$WithFilter$$anonfun$foreach$1.apply(TraversableLike.scala:733)
        at scala.collection.mutable.HashMap$$anon$1$$anonfun$foreach$2.apply(HashMap.scala:103)
        at scala.collection.mutable.HashMap$$anon$1$$anonfun$foreach$2.apply(HashMap.scala:103)
        at scala.collection.mutable.HashTable$class.foreachEntry(HashTable.scala:230)
        at scala.collection.mutable.HashMap.foreachEntry(HashMap.scala:40)
        at scala.collection.mutable.HashMap$$anon$1.foreach(HashMap.scala:103)
        at scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:732)
        at org.apache.spark.util.FieldAccessFinder$$anon$3.visitMethodInsn(ClosureCleaner.scala:432)
        at org.apache.xbean.asm5.ClassReader.a(Unknown Source)
        at org.apache.xbean.asm5.ClassReader.b(Unknown Source)
        at org.apache.xbean.asm5.ClassReader.accept(Unknown Source)
        at org.apache.xbean.asm5.ClassReader.accept(Unknown Source)
        at org.apache.spark.util.ClosureCleaner$$anonfun$org$apache$spark$util$ClosureCleaner$$clean$14.apply(ClosureCleaner.scala:262)
        at org.apache.spark.util.ClosureCleaner$$anonfun$org$apache$spark$util$ClosureCleaner$$clean$14.apply(ClosureCleaner.scala:261)
        at scala.collection.immutable.List.foreach(List.scala:381)
        at org.apache.spark.util.ClosureCleaner$.org$apache$spark$util$ClosureCleaner$$clean(ClosureCleaner.scala:261)
        at org.apache.spark.util.ClosureCleaner$.clean(ClosureCleaner.scala:159)
        at org.apache.spark.SparkContext.clean(SparkContext.scala:2299)
        at org.apache.spark.SparkContext.runJob(SparkContext.scala:2073)
        at org.apache.spark.SparkContext.runJob(SparkContext.scala:2099)
        at org.apache.spark.rdd.RDD$$anonfun$collect$1.apply(RDD.scala:945)
        at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151)
        at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:112)
        at org.apache.spark.rdd.RDD.withScope(RDD.scala:363)