0

我想调试我的程序,但我无法在 VS 2010 中托管我的 silverlight 项目,这是 VS 发送给我的消息:

“您要调试的 Silverlight 项目使用 Web 服务。除非 Silverlight 是宿主并且从同一个 Web 项目启动并包含 Web 服务,否则对 Web 服务的调用将失败”

当我在网上搜索它时,我发现问题是我不是在本地做的,所以当我试图改变这一行时

endpoint address="http://xxx.xx.x.x/WebService/Service1.svc"

endpoint address="http://localhost/WebService/Service1.svc"

在这个文件上:ServiceReferences.ClientConfig

更新!!

我现在试着这样做:

endpoint address="http://localhost:54502/Service1.svc"

我得到了一个错误,上面写着:

the remote server returned an error:NotFound

这里:

 public int EndAddParticipant(System.IAsyncResult result) {
                object[] _args = new object[0];
                int _result = ((int)(base.EndInvoke("AddParticipant", _args, result)));
                return _result;

我应该怎么做才能改变它?我看到我需要打开 web.config 文件中的调试,但它已经打开了。

4

1 回答 1

0

You didn't explain well so here are a bunch of answers:

When you created your solution, you should have told it to host in a web site.

You can do this after the fact but it is a lot of work (for a new guy), you're better off starting over and copying your code from your silverlight project.

If you did but you are trying to connect to another web site as your web service, you will have to implement a Cross Domain configuration file. This opens a big security hole though.

If you have the 2 projects, but your issue is just the "ServiceReferences.ClientConfig" file not pointing the the right server, you need to include the PORT when debugging locally. It should look something like this:

http://localhost:12345/Service1.svc

Where 12345 is the port of your local web service. You can find this out by looking at the "Web" tab of your project properties.

Hope one of these does it. If not, please provide a little more info, like all the important stuff behind the phrase, "it didn't work"!

于 2013-10-22T22:47:29.237 回答