简体   繁体   English

发布Silverlight应用程序后出现错误

[英]Error after publishing Silverlight application

Hello everybody today i published silverlight application. 大家好,我今天发布了Silverlight应用程序。

When its starts it gives such errors: What you think does it connection string problem or not? 它启动时会出现以下错误:您认为连接字符串有问题还是没有问题?

在此处输入图片说明

This is what Fiddler says 这就是提琴手所说的

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

I have seen something similar occur because the data sent across the wire was too large for WCF. 我看到类似的情况发生,因为通过导线发送的数据对于WCF而言太大。 Can you distill the first call to a hello world method? 您可以提取对hello world方法的第一个调用吗?

BTW if one highlights a message box window and does a CTRL-C, usually the system can copy the erorr text into the clipboard and then later one can paste it into a document without having to do a screen shot. 顺便说一句, 如果突出显示一个消息框窗口并执行CTRL-C,通常系统可以将erorr文本复制到剪贴板中,然后再将其粘贴到文档中,而不必进行屏幕截图。 I advise all my test users to do that instead of the screen shot. 我建议所有测试用户都这样做,而不要截屏。

Based on the error message, it could be that the WCF Service was not found at the URL specified in the Silverlight client. 根据错误消息,可能是在Silverlight客户端中指定的URL上找不到WCF服务。 It could also mean that something failed within the WCF service. 这也可能意味着WCF服务中出现故障。

There are two primary ways to troubleshoot WCF issues like this: 解决WCF问题的主要方法有两种:

1) Use Fiddler to track the traffic between the silverlight client and WCF service. 1)使用Fiddler来跟踪silverlight客户端和WCF服务之间的流量。 This will often show more detailed information such as the exact URL that is used and IIS responses that otherwise appear to the WCF client as invalid responses. 这通常会显示更详细的信息,例如所使用的确切URL和IIS响应,否则这些响应对WCF客户端将显示为无效响应。

2) Enable detailed WCF tracing by adding the following block to you web.config's configuration section: 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>

After reproducing the error, double-clicking on the file name specified will show the WCF log viewing application, which you can use to drill into the specific errors that occur. 重现错误后,双击指定的文件名将显示WCF日志查看应用程序,您可以使用该应用程序来深入研究发生的特定错误。 This is particularly helpful when dealing with serialization issues. 在处理序列化问题时,这特别有用。

Update 更新资料

Based on the fiddler output (http response 500), the WCF service is throwing an exception. 根据提琴手的输出(http响应500),WCF服务引发异常。 Here is some information from Microsoft on faults in WCF services and how to handle them. 这是 Microsoft的一些有关 WCF服务中的故障及其处理方法的信息。

Your next step should be to enable the WCF tracing as shown in item 2 above, then examine the output. 下一步应该是启用WCF跟踪,如上面第2项所示,然后检查输出。 You could also check the windows event logs for issues, but I suspect you won't see any. 您也可以检查Windows事件日志中的问题,但是我怀疑您不会看到任何问题。

I also strongly recommend wrapping the body of every WCF service method in a try/catch statement so that you can catch and report bugs in your code intelligently rather than trying to propagate them back to the WCF client, at least until you get the kinks worked out. 我还强烈建议在try / catch语句中包装每个WCF服务方法的主体,以便您可以智能地捕获和报告代码中的错误,而不是尝试将其传播回WCF客户端,至少直到您使这些错误解决为止出来。

If you do want faults propagated back to the WCF client, you should decorate the interface methods with the FaultContract attribute, ie 如果您确实希望将故障传播回WCF客户端,则应使用FaultContract属性装饰接口方法,即

[FaultContract(typeof(WCFException))]

What would happen when you open (you site)/client/ClientBin/RoadTrans-Web-DataDomainService.svc in broser? 在broser中打开(站点)/client/ClientBin/RoadTrans-Web-DataDomainService.svc会发生什么?

Try open it on server, or enable shown error to all clients (in web.config). 尝试在服务器上打开它,或对所有客户端启用显示的错误(在web.config中)。

See this video to more tips in WCF Debugging 观看此视频以获取WCF调试中的更多提示

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM