WP7,将服务引用添加到 Visual Studio 2010 后如何使用服务引用

发布于 2024-10-04 06:20:24 字数 377 浏览 0 评论 0原文

我按照以下示例连接到 Bing 地图地理编码服务:

链接

大约在页面的一半处,它解释了如何在 Visual Studio 2010 中添加服务引用,我成功地做到了这一点。然后它说添加“使用 GeoCode.GeoCodeService”,但是当我这样做时,我收到一条错误消息“找不到类型或命名空间‘GeoCode’”

我做错了什么吗?步骤非常简单,没有任何错误。我还需要做什么才能访问该服务?

I'm following this example for connecting to the Bing Maps geocode service:

Link

About half way down the page, it explains how to add a service reference in Visual Studio 2010, which I was able to do successfully. Then it says to add "using GeoCode.GeoCodeService", but when I do, I get an error saying "The type or namespace 'GeoCode' could not be found"

Am I doing something wrong. The steps are pretty simple and nothing gave an error. What else do I need to do in order to access the service?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

猥琐帝 2024-10-11 06:20:24

使用 WSDL URL 添加引用后:

在“解决方案”下的“服务引用”下,右键单击要引用的服务引用文件夹(例如:com.gold.services.description1),

选择“在对象浏览器中查看”。
您将在打开的对象浏览器窗口中看到类名称。
(示例:GoldWeb.com.gold.services.description1)

将类名称复制并粘贴到您的代码中。

示例:

using GoldWeb.com.gold.services.description1;

然后您就可以开始使用它的类了。

After you added a Reference using your WSDL URL:

Under Solution, under Service References, right click on your Service Reference folder that you want to reference (example: com.gold.services.description1)

Select View in Object Browser.
You will see the class name in the Object Browser window that will open up.
(example: GoldWeb.com.gold.services.description1)

Copy and paste the class name into your code.

Example:

using GoldWeb.com.gold.services.description1;

Then you are ready to start using its classes.

枕花眠 2024-10-11 06:20:24

添加服务引用时,您为其指定了一个类名。查看解决方案资源管理器以了解您对它的称呼,然后您必须实例化该类才能使用该服务。

When you added the service reference, you gave it a class name. Have a look in your solution explorer to see what you called it, and then you have to instantiate that class to use the service.

晨与橙与城 2024-10-11 06:20:24

当一项服务可能被添加到一个项目并在另一个项目中被反向引用时,我就看到了这种情况的发生。例如,主项目具有服务引用,但主项目中引用的库代码尝试实例化 Web 服务。这是循环/反向引用,您无法将主项目的命名空间添加回库项目中,因为库项目已经引用到主项目中。我知道这看起来很明显,但在真正的大型项目中,很容易迷失在代码中。

I seen this happen, when a service may be added to one project and is being back referenced in another project. For instance, the main project has the service reference, but library code, that's is reference in the main project, tries to instantiate the webservice. This is a circular/backreference and you can't add the namespace of the main project back into the library project, since the library project is already reference into the main project. I know this seem obvious, but in really big projects, it's easy to get lost to where you're at in code.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文