如何在Silverlight中调试webservices

时间:2021-10-12 20:44:44

I have webservices(that I myself created for database interaction) that are hosted in the same webproject that loads my silverlight project. Whenever I place a breakpoint to iterate through the code via the async methods, visual studio merely points me to the response event (completed event) skipping the code that is in the webservice therefore wouldn't know what is happening inside them. Is there an option to enable debugging in the webservices?

我有webservices(我自己创建用于数据库交互),它们托管在加载我的silverlight项目的同一个webproject中。每当我通过异步方法放置断点来迭代代码时,visual studio只会指向响应事件(已完成的事件),跳过Web服务中的代码,因此不知道它们内部发生了什么。是否有在Web服务中启用调试的选项?

3 个解决方案

#1


Figured out why it was entering the webservices, I set the silverlight project instead of the web project as the start up project

弄清楚为什么它进入了网络服务,我设置了silverlight项目而不是web项目作为启动项目

#2


If Both of your services and web project in the same environment then ,

如果您的服务和Web项目都在同一环境中,那么,

  1. Right click on wcfservice1 (service project folder) ---> debug ---> start new instance

    右键单击wcfservice1(服务项目文件夹)---> debug --->启动新实例

  2. Similarly, Right click on web project folder ---> debug ---> start new instance

    同样,右键单击web项目文件夹---> debug --->启动新实例

Make break point now in both the files and start debugging..simple...

现在在两个文件中创建断点并开始调试..简单...

#3


One way is to enable WebService trace option. By default, WCF services do not report detailed information as service errors are technology specific to that service and should not transcend the service boundary. You would need to write additional code to disclose detailed exception info. Enabling service tracing will allow you to log service calls and exceptions, and see the stack trace, without the additional coding, and polluting your client with service exception handlers.

一种方法是启用WebService跟踪选项。默认情况下,WCF服务不会报告详细信息,因为服务错误是特定于该服务的技术,不应超出服务边界。您需要编写其他代码来披露详细的异常信息。启用服务跟踪将允许您记录服务调用和异常,并查看堆栈跟踪,无需额外编码,并使用服务异常处理程序污染客户端。

The quickest way to do this is to use the WCF Service Configuration Editor (under Tools in VS2008). Once you run the editor, open config file that contains your service settings. In the editor go to Diagnostics menu "folder" and click 'Enable Tracing'. Clicking on the Trace Level options will bring up an dialog ... set the Trace Level drop-down to Error. Click on ServiceModelTraceListener and check the Callstack option ... maybe change the path of the log file for your convenience. Save.

最快的方法是使用WCF服务配置编辑器(在VS2008中的工具下)。运行编辑器后,打开包含服务设置的配置文件。在编辑器中,转到诊断菜单“文件夹”,然后单击“启用跟踪”。单击Trace Level选项将弹出一个对话框...将Trace Level下拉列表设置为Error。单击ServiceModelTraceListener并检查Callstack选项...可能会更改日志文件的路径以方便您使用。保存。

When you double click the .svclog file that is generated, Microsoft Service Trace Viewer will fire up that will show you what the service is doing.

双击生成的.svclog文件时,将启动Microsoft Service Trace Viewer,它将显示服务正在执行的操作。

ib.

#1


Figured out why it was entering the webservices, I set the silverlight project instead of the web project as the start up project

弄清楚为什么它进入了网络服务,我设置了silverlight项目而不是web项目作为启动项目

#2


If Both of your services and web project in the same environment then ,

如果您的服务和Web项目都在同一环境中,那么,

  1. Right click on wcfservice1 (service project folder) ---> debug ---> start new instance

    右键单击wcfservice1(服务项目文件夹)---> debug --->启动新实例

  2. Similarly, Right click on web project folder ---> debug ---> start new instance

    同样,右键单击web项目文件夹---> debug --->启动新实例

Make break point now in both the files and start debugging..simple...

现在在两个文件中创建断点并开始调试..简单...

#3


One way is to enable WebService trace option. By default, WCF services do not report detailed information as service errors are technology specific to that service and should not transcend the service boundary. You would need to write additional code to disclose detailed exception info. Enabling service tracing will allow you to log service calls and exceptions, and see the stack trace, without the additional coding, and polluting your client with service exception handlers.

一种方法是启用WebService跟踪选项。默认情况下,WCF服务不会报告详细信息,因为服务错误是特定于该服务的技术,不应超出服务边界。您需要编写其他代码来披露详细的异常信息。启用服务跟踪将允许您记录服务调用和异常,并查看堆栈跟踪,无需额外编码,并使用服务异常处理程序污染客户端。

The quickest way to do this is to use the WCF Service Configuration Editor (under Tools in VS2008). Once you run the editor, open config file that contains your service settings. In the editor go to Diagnostics menu "folder" and click 'Enable Tracing'. Clicking on the Trace Level options will bring up an dialog ... set the Trace Level drop-down to Error. Click on ServiceModelTraceListener and check the Callstack option ... maybe change the path of the log file for your convenience. Save.

最快的方法是使用WCF服务配置编辑器(在VS2008中的工具下)。运行编辑器后,打开包含服务设置的配置文件。在编辑器中,转到诊断菜单“文件夹”,然后单击“启用跟踪”。单击Trace Level选项将弹出一个对话框...将Trace Level下拉列表设置为Error。单击ServiceModelTraceListener并检查Callstack选项...可能会更改日志文件的路径以方便您使用。保存。

When you double click the .svclog file that is generated, Microsoft Service Trace Viewer will fire up that will show you what the service is doing.

双击生成的.svclog文件时,将启动Microsoft Service Trace Viewer,它将显示服务正在执行的操作。

ib.