你能不能改在.NET在运行时动态的Web引用位置/端点?你能、位置、动态、NET

2023-09-04 02:14:58 作者:笑看你演

在一个相当标准的方式,我创建了一个Web引用到JIRA中SOAP服务的,我要建一个扩展(吉拉是为那些不熟悉它的问题跟踪器)。 Visual Studio中自动生成一个 .Settings 文件和的app.config 包含Web服务的URL。

In a fairly standard fashion, I created a Web Reference to a SOAP service in Jira for an extension that I'm building (Jira is an issue tracker for those unfamiliar with it). Visual Studio auto-generates a .Settings file and an app.config that contains the web service URL.

由于我开发一个扩展/插件的ALM产品,我们正在建设的中的消费者的扩展将成为一个谁最终决定在哪里此Web服务点,因为它会与吉拉的消费者的实例集成。假定Web服务URL将被存储和从数据库中抽取。

Since I'm developing an extension/plugin to an ALM product we're building, the consumer of the extension will be the one who ultimately decides where this web service points to, because it will be integrated with the consumer's instance of Jira. Assume that the web service URL would be stored and pulled from a database.

我怎样才能自动生成的服务,从数据库中,而不是从使用URL生成的的app.config

How can I get the auto-generated service to use a URL from a database instead of from the generated app.config?

注:我们正在使用的框架2.0,所以WCF是不是一种选择的

推荐答案

即使在2.0的Web服务,您应该可以将您的Web服务代理的URL属性更改为你所希望的值。

Even in the 2.0 web service you should be able to change the "Url" property of your web service proxy to the value you desire.