你能不能改在.NET在运行时动态的Web引用位置/端点? [英] Can you change the location/endpoint of a dynamic web reference at run-time in .NET?

查看:150
本文介绍了你能不能改在.NET在运行时动态的Web引用位置/端点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个相当标准的方式,我创建了一个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.

这篇关于你能不能改在.NET在运行时动态的Web引用位置/端点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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