如何更改在生产.NET网站Web引用? [英] How do I change a web reference in a production .NET website?

查看:182
本文介绍了如何更改在生产.NET网站Web引用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的Web引用似乎并没有在消耗它的网站的web.config文件中定义。我发现,在Web引用文件夹,看起来可编辑的名为Reference.map一个配置文件,但是当我编辑没有任何反应。我甚至改名为WSDL文件的文件夹中,看它是否会得到一个新的。事实并非如此。

Our web reference does not seem to be defined in web.config of the website that consumes it. I found that there is a configuration file called "Reference.map" in the "Web References" folder that looks editable, but when I edit them nothing happens. I even renamed the WSDL file in the folder to see if it would get a new one. It did not.

我必须做的构建只是改变引用的Web服务的URL?

Do I have to do a build just to change the URL of a referenced Web Service?

推荐答案

您可以标记一个Web引用作为静态或动态的URL。如果你选择的动态,它可以将网址添加到Web.config然后你就可以在生产环境中改变。

You can mark a web reference as static or dynamic URL. If you choose dynamic then it will add the URL to the web.config which you can then change in your production environment.

如果它被标记为静态然后它被编译成二进制,而不是可变不会重建

If it is marked as static then it is compiled into the binary and is not changeable without a rebuild.

如果它已经是动态的那么code相对于动态的URL,然后如果它不能找到它,然后它使用默认的原件。因此,你可以添加一个进入web配置,如:

If it is already dynamic then the code looks for the dynamic URL and then if it can't find it then it uses the default original. Therefore, you can just add an entry into the web config such as:

<applicationSettings>
    <MySystem.Properties.Settings>
        <setting name="MySystem_MyService" serializeAs="String">
            <value>http://mysystem/service.asmx</value>
        </setting>
    </MySystem.Properties.Settings>
</applicationSettings>

这篇关于如何更改在生产.NET网站Web引用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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