应该修改什么来更改 C# 中的 Web 服务的 URL? [英] What should be modified to change the URL of a web service in C#?

查看:65
本文介绍了应该修改什么来更改 C# 中的 Web 服务的 URL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题,前段时间我通过复制所有生成的代码(复制粘贴 .cs 内容的文本)在我的应用程序中添加了一个 Webservice 代理类.

I have one problem and it is some time ago I have added a Webservice proxy class into my application by copying all the generated code (copy paste the text of the .cs content).

它奏效了!

但现在我需要更改此 Web 服务代理类使用的 URL,但我不确定代码中要更改的内容和位置.

But now I need to change the URL used by this web-service proxy class and I am not sure what and where to change in the code.

如果您能给我一个可以指导我找到正确位置的线索,以便我可以更新网络服务的网址,我将不胜感激.

I would appreciate if you can give me a clue that can guide me to find the right place so that I can update the url of the web service.

推荐答案

您应该使用 web.config 更改 URL.如果您转到添加的 Web 引用的属性,您应该会看到一个名为'URL 行为'"的属性.将其值设置为动态"并提供 URL.这将在 web.config 中创建一个条目,每当您更改该条目时,都会采用该 URL.更多信息这里.

You should change the URL using web.config. If you go to the properties of the web reference added, you should see a property named "'URL Behavior'". Set the value of that to "dynamic" and supply the URL. That would make an entry in the web.config and whenever you change that entry, that URL will be taken. More info here.

这篇关于应该修改什么来更改 C# 中的 Web 服务的 URL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆