简体   繁体   English

使用WCF服务调试Silverlight项目

[英]Debugging a Silverlight project with a WCF service

I have a WCF service hosted in IIS which is consumed by a Silverlight client application. 我在IIS中托管了WCF服务,该服务由Silverlight客户端应用程序使用。 When I run the Silverlight application, none of the break points seem to get hit (not breakpoints in the service, although they also don't get hit. That service is not in the same solution). 当我运行Silverlight应用程序时,似乎没有一个断点被击中(服务中没有断点,尽管它们也没有被击中。该服务不在同一解决方案中)。

Normally when I've created SL projects in the past, they hit break points by default, and I can't thing I've changed any of the settings. 通常,当我过去创建SL项目时,默认情况下它们会达到断点,因此我不能更改任何设置。

When I run the project, I do get a message box saying, "The Silverlight project you are about to debug uses web services. Calls to the web service will fail unless the Silverlight project is hosted in and launched from the same web project as the web services. Do you want to debug anyway?" 当我运行该项目时,确实出现一个消息框,“您将要调试的Silverlight项目使用Web服务。对该Web服务的调用将失败,除非将Silverlight项目托管在与该项目相同的Web项目中并从该项目启动。 Web服务。还是要调试吗?”

So I say 'yes'. 所以我说“是”。

My break point is in a place that I know gets hit (InitializeComponent in MainPage.xaml.cs), so that's not it. 我的断点是在我知道被命中的地方(MainPage.xaml.cs中的InitializeComponent),不是那样。

I don't know if it makes a difference to the client application, but the WCF service does have within its App.config the compilation debug set to 'true'. 我不知道它是否对客户端应用程序有所影响,但是WCF服务在其App.config中确实将编译调试设置为“ true”。

Can anyone help? 有人可以帮忙吗?

Edit: 编辑:

Some useful points: The project is set to debug. 一些有用的要点:该项目设置为调试。 There is no web component to the SL project. SL项目没有Web组件。 The application compiles and runs normally. 该应用程序将编译并正常运行。 The code in the screen shot below is the code behind for the main page which is the default page (and the one I see when I start the project). 下面的屏幕快照中的代码是主页(默认页面)(以及我在启动项目时看到的页面)后面的代码。 The Visual Studio version is 2010 Ultimate (version 10.0.40219.1 SPRel) and I am not creating an OOB application. Visual Studio版本是2010 Ultimate(版本10.0.40219.1 SPRel),我没有创建OOB应用程序。 As well as just running regularly, I have specifically started from the Debug->Start Debugging option in Visual Studio. 除了正常运行外,我还专门从Visual Studio中的“调试”->“启动调试”选项开始。

Screen shot: 屏幕截图:

在此处输入图片说明

If that image isn't clear enough, there is the full resolution one here. 如果该图像不够清晰,则此处为完整分辨率

Second screen shot showing a break point on the InitializeComponent in MainPage.xaml.cs which doesn't fire (the previous one showed the constructor of the related view model). 第二个屏幕截图显示了不会触发的MainPage.xaml.cs中InitializeComponent上的一个断点(上一个屏幕截图显示了相关视图模型的构造函数)。

在此处输入图片说明

Again, if that's not clear enough, the full resolution version is here. 同样,如果还不够清晰,请点击此处查看完整分辨率版本

The message your getting is unrelated to your breakpoints not being hit. 您得到的消息与未命中断点无关。 This 'warning' isn't entirely true as well, as long a the webservice you're calling is running you'll be fine. 这个“警告”也不是完全正确的,只要您正在调用的Web服务正在运行,您就可以了。 You can happily ignore this warning. 您可以高兴地忽略此警告。

As to not hitting breakpoints, I can think of two reasons. 至于没有达到断点,我可以想到两个原因。 You could be building in release mode, or you could be starting the wrong project. 您可能正在发布模式下构建,或者您可能启动了错误的项目。 You should not be starting the MyApp.Web project Visual Studio probably created for you, but the actual Silverlight project. 您不应该启动可能是为您创建的Visual Studio MyApp.Web项目,而是实际的Silverlight项目。

If it isn't one of those options you should provide a bit more detail about what you're doing, like Visual Studio versions, whether you're running an out-of-browser app, does the app actually work etc. There can be a few more things to check but it hard to guess it them with this little info. 如果不是这些选项之一,则应提供有关您正在执行的操作的更多详细信息,例如Visual Studio版本,是否正在运行浏览器外应用程序,该应用程序是否实际运行等。还需要检查几件事,但是很难通过这些小信息来猜测它们。

I'm not seeing a test page.htm in your solution. 我没有在您的解决方案中看到测试page.htm。 How are you hosting / running the SL app? 您如何托管/运行SL应用程序?

If you were hosting it in an ASP.NET web app I'd say check that the Silverlight debugger was enabled on the web project project properties. 如果您将其托管在ASP.NET Web应用程序中,我会说要检查是否在Web项目项目属性上启用了Silverlight调试器。

But as it is I can't see how the silverlight app is getting run at all...? 但由于它是我完全看不到Silverlight应用程序如何运行...?

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

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