【问题标题】:No connection to wcf service with oob except when fiddler is running除非 fiddler 正在运行,否则无法使用 oob 连接到 wcf 服务
【发布时间】:2013-03-13 04:13:09
【问题描述】:

我有一个 silverlight 应用程序,该应用程序通过 wcf (SSL/https) 连接到托管在 iis 上的公共服务。如果我在浏览器中启动应用程序,一切正常。一旦我以“退出浏览器模式”启动应用程序,它就不再工作了。我试图找出提琴手的问题,但只要提琴手正在运行,一切正常。我在互联网上找到了很多关于此的帖子,但没有任何效果。有什么想法吗? fiddler 到底做了什么并让它在 oob 中运行?

总结: 1.一切正常“在浏览器中” 2. 运行“Out of Browser”时没有连接到公共服务 3. 只要 Fiddler 运行,它就会运行“Out of Browser”

以下是我如何进行连接的一些信息。

非常感谢您的帮助。

最好的问候。 马克

以下是我如何做所有事情的一些信息:

自签名证书有没有可能与所有有关?

客户端与公共服务的连接如下所示:

 PublicServiceClient proxy;
    BinaryMessageEncodingBindingElement binaryMessageEncodingBindingElement = new     BinaryMessageEncodingBindingElement();
    HttpsTransportBindingElement httpsTransportBindingElement = new HttpsTransportBindingElement();
    httpsTransportBindingElement.MaxBufferSize = int.MaxValue;
    httpsTransportBindingElement.MaxReceivedMessageSize = int.MaxValue;
    httpsTransportBindingElement.TransferMode = TransferMode.Buffered;
    Binding binding = new CustomBinding(binaryMessageEncodingBindingElement,     httpsTransportBindingElement);
    binding.SendTimeout = new TimeSpan(0, 0, _WcfTimeout);
    binding.ReceiveTimeout = new TimeSpan(0, 0, _WcfTimeout);
    binding.OpenTimeout = new TimeSpan(0, 0, _WcfTimeout);
    binding.CloseTimeout = new TimeSpan(0, 0, _WcfTimeout);
    proxy = new PublicServiceClient(binding, new EndpointAddress("https://" +     App.CurrentParameter.WcfDomain + "/PublicService.svc"));

绑定服务器端(web.config):

   <binding name="Web.PublicService.customBinding0" sendTimeout="00:01:00" receiveTimeout="00:01:00" openTimeout="00:01:00" closeTimeout="00:01:00">
    <binaryMessageEncoding maxReadPoolSize="2147483647" maxWritePoolSize="2147483647">
    <readerQuotas maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="2147483647" maxNameTableCharCount="2147483647" maxStringContentLength="2147483647"/>
    </binaryMessageEncoding>
    <httpsTransport maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" keepAliveEnabled="false"/>
    </binding>

服务服务器端(web.config):

  <service name="Web.PublicService">
    <endpoint address="" binding="customBinding"    bindingConfiguration="Web.PublicService.customBinding0" contract="Web.PublicService"/>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
    </service>

【问题讨论】:

  • 在没有 fiddler 的情况下运行 OOB 时的行为是什么,但连接不是 SSL?你能测试这样的场景吗?
  • 连接始终是 SSL。如果它在 OOB 中运行,则会发生以下错误:Während des Vorgangs ist eine Ausnahme aufgetreten, sodass das Ergebnis ungültig ist。 Weitere Ausnahmedtails finden Sie in InnerException。 | 0 | 0 | Void RaiseExceptionIfNecessary() 在 Void RaiseExceptionIfNecessary() 第 0 行 第 0 列在 SL.PublicServiceReference.CustomerData get_Result() 第 0 行 第 0 列在 Void OnGetCustomerDataCompleted(System.Object, SL.PublicServiceReference.GetCustomerDataCompletedEventArgs) 第 0 行 第 0 列在 Void OnGetCustomerDataCompleted(System.对象)第0行第0列
  • 好吧,内部异常怎么说? ;) 您是否已经激活 tracing 以获取有关错误的更多详细信息?
  • 我尝试了跟踪,但在 OOB 中没有任何记录。我想来自 OOB 的调用永远不会到达服务器,因此不会记录任何内容。内部异常看起来像:InnerException {System.ServiceModel.CommunicationException: Der Remoteserver hat einen Fehler zurückgegeben: NotFound。 System.Net.WebException:...:未找到。 System.Net.WebException:...:未找到。北 System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult) 北 System.Net.Browser.BrowserHttpWebRequest.c__DisplayClassa.b__9(Object sendState) 北 System.Net.Browser.Asy...

标签: wcf silverlight fiddler


【解决方案1】:

如果您在 Fiddler 中禁用 HTTPS 解密(并重新启动它)并且应用程序停止通过 Fiddler 运行,这意味着服务器上正在使用的自签名证书是问题所在,您需要通过信任该证书来修复它.

如果在 Fiddler 中禁用 HTTPS 解密没有影响,则问题可能与安全区域设置有关。请参阅http://blogs.msdn.com/b/fiddler/archive/2010/11/22/fiddler-and-silverlight-cross-zone-cross-domain-requests.aspx 了解有关原因的详细信息。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-06-25
    • 2015-10-19
    • 1970-01-01
    • 2012-01-30
    • 2018-01-24
    相关资源
    最近更新 更多