发布Silverlight应用程序后出错

时间:2011-12-28 19:01:17

标签: c# silverlight wcf wcf-ria-services

大家好,今天我发布了silverlight应用程序。

当它启动时会出现这样的错误: 您认为它是否与字符串问题有关?

enter image description here

这就是Fiddler所说的

Request Count:  3
Bytes Sent:     1,224    (headers:1224; body:0)
Bytes Received: 16,890    (headers:792; body:16098)

URLS:

/client/ClientBin/RoadTrans-Web-DataDomainService.svc/binary/GetTransFul

Statistics:

Request Count:  1
Bytes Sent:     403    (headers:403; body:0)
Bytes Received: 5,630    (headers:264; body:5366)

ACTUAL PERFORMANCE
--------------
ClientConnected:    06:22:36.697
ClientBeginRequest:    06:22:37.428
GotRequestHeaders:    06:22:37.428
ClientDoneRequest:    06:22:37.428
Determine Gateway:    0ms
DNS Lookup:         0ms
TCP/IP Connect:    0ms
HTTPS Handshake:    0ms
ServerConnected:    06:21:35.848
FiddlerBeginRequest:    06:22:37.428
ServerGotRequest:    06:22:37.428
ServerBeginResponse:    06:22:37.443
GotResponseHeaders:    06:22:37.443
ServerDoneResponse:    06:22:37.443
ClientBeginResponse:    06:22:37.443
ClientDoneResponse:    06:22:37.443

    Overall Elapsed:    00:00:00.0150009

RESPONSE CODES
--------------
HTTP/500:     1

RESPONSE BYTES (by Content-Type)
--------------
text/html:    5,366
~headers~:    264

URL:

/client/ClientBin/RoadTrans-Web-DataDomainService.svc/binary/GetPaymentWithCustomer

Statistics:

Request Count:  1
Bytes Sent:     414    (headers:414; body:0)
Bytes Received: 5,630    (headers:264; body:5366)

ACTUAL PERFORMANCE
--------------
ClientConnected:    06:22:37.443
ClientBeginRequest:    06:22:38.834
GotRequestHeaders:    06:22:38.834
ClientDoneRequest:    06:22:38.834
Determine Gateway:    0ms
DNS Lookup:         0ms
TCP/IP Connect:    0ms
HTTPS Handshake:    0ms
ServerConnected:    06:21:35.848
FiddlerBeginRequest:    06:22:38.834
ServerGotRequest:    06:22:38.834
ServerBeginResponse:    06:22:38.846
GotResponseHeaders:    06:22:38.846
ServerDoneResponse:    06:22:38.846
ClientBeginResponse:    06:22:38.846
ClientDoneResponse:    06:22:38.846

    Overall Elapsed:    00:00:00.0120006

RESPONSE CODES
--------------
HTTP/500:     1

RESPONSE BYTES (by Content-Type)
--------------
text/html:    5,366
~headers~:    264

ESTIMATED WORLDWIDE PERFORMANCE

URL:

/client/ClientBin/RoadTrans-Web-DataDomainService.svc/binary/GetCreditorFull

Statistics:

Request Count:  1
Bytes Sent:     407    (headers:407; body:0)
Bytes Received: 5,630    (headers:264; body:5366)

ACTUAL PERFORMANCE
--------------
ClientConnected:    06:22:09.870
ClientBeginRequest:    06:22:38.834
GotRequestHeaders:    06:22:38.834
ClientDoneRequest:    06:22:38.834
Determine Gateway:    0ms
DNS Lookup:         0ms
TCP/IP Connect:    2ms
HTTPS Handshake:    0ms
ServerConnected:    06:22:38.838
FiddlerBeginRequest:    06:22:38.838
ServerGotRequest:    06:22:38.838
ServerBeginResponse:    06:22:38.863
GotResponseHeaders:    06:22:38.863
ServerDoneResponse:    06:22:38.863
ClientBeginResponse:    06:22:38.863
ClientDoneResponse:    06:22:38.864

    Overall Elapsed:    00:00:00.0300017

RESPONSE CODES
--------------
HTTP/500:     1

RESPONSE BYTES (by Content-Type)
--------------
text/html:    5,366
~headers~:    264

ESTIMATED WORLDWIDE PERFORMANCE

3 个答案:

答案 0 :(得分:2)

我看到类似的情况发生,因为通过网络发送的数据对于WCF来说太大了。你可以提炼第一次调用hello world方法吗?

BTW 如果有人突出显示一个消息框窗口并执行CTRL-C,通常系统可以将erorr文本复制到剪贴板中,然后可以将其粘贴到文档中而无需进行屏幕截图。我建议我所有的测试用户都这样做而不是屏幕截图。

答案 1 :(得分:1)

根据错误消息,可能是在Silverlight客户端中指定的URL处找不到WCF服务。它也可能意味着WCF服务中的某些内容失败。

有两种主要方法可以解决WCF问题:

1)使用Fiddler跟踪silverlight客户端和WCF服务之间的流量。这通常会显示更详细的信息,例如使用的确切URL和以WCF客户端显示为无效响应的IIS响应。

2)通过将以下块添加到web.config的配置部分来启用详细的WCF跟踪:

  <system.diagnostics>
    <sources>
      <source name="System.ServiceModel"
              switchValue="Information, ActivityTracing"
              propagateActivity="true">
        <listeners>
          <add name="traceListener"
              type="System.Diagnostics.XmlWriterTraceListener"
              initializeData="c:\log\WebTrace.svclog"  />
        </listeners>
      </source>
    </sources>
  </system.diagnostics>

重现错误后,双击指定的文件名将显示WCF日志查看应用程序,您可以使用该应用程序深入查看发生的特定错误。在处理序列化问题时,这尤其有用。

<强>更新

基于fiddler输出(http响应500),WCF服务抛出异常。来自Microsoft的Here is some information有关WCF服务中的错误以及如何处理它们。

您的下一步应该是启用WCF跟踪,如上面第2项所示,然后检查输出。您还可以检查Windows事件日志中的问题,但我怀疑您不会看到任何问题。

我还强烈建议在try / catch语句中包装每个WCF服务方法的主体,以便您可以智能地捕获和报告代码中的错误,而不是尝试将它们传播回WCF客户端,至少在您获得之前扭结了。

如果您确实希望将错误传播回WCF客户端,则应使用FaultContract属性修饰接口方法,即

[FaultContract(typeof(WCFException))]

答案 2 :(得分:0)

当你在broser中打开(你的网站)/client/ClientBin/RoadTrans-WeboconutDomainService.svc时会发生什么?

尝试在服务器上打开它,或为所有客户端启用显示的错误(在web.config中)。

See this video to more tips in WCF Debugging