如果服务器名称更改,则连接字符串会自动更改 [英] If server name is change then connection string change automaticlly

查看:112
本文介绍了如果服务器名称更改,则连接字符串会自动更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨..朋友,我正在vb.net中创建一个项目,是否有可能在vb.net中更改我的服务器名称,则连接字符串应该自动更改,如果是,那么请告诉它如何有可能

在此先感谢

Parveen Rathi

Hi.. friends I''m making a project in vb.net, is that possible in vb.net that if my server name has been changed the connection string should be changed automatically, if yes then please tell how it can be possible

Thanks in advance

Parveen Rathi

推荐答案

没有工具可以自动执行此操作.您可以通过编程方式在Web.Config中修改ConnectionString.
检查以下链接.

http://stackoverflow.com/questions/2260317/change-a- web-config-programmatically-with-c-net [ ^ ]
There is no tool to automate this. You can modify the ConnectionString in Web.Config programmatically.
Check the below link.

http://stackoverflow.com/questions/2260317/change-a-web-config-programmatically-with-c-net[^]


通常,如果发生故障转移等情况,您将使用名称而不是IP地址作为连接字符串.最好创建一个DNS别名并将其更改为备份服务器.

这样,您的服务器名称始终是相同的.
Usually you would use a name instead of IP addresses for your connection string, in the event of failovers etc. it is best to create a DNS alias and change that to a backup server.

This way your server name is always the same.


您的应用程序如何直接知道服务器名称已更改?

这是定制的活动.您需要编写一个代码/EXE,服务器名称更改后应由用户触发.
How your application knows directly, that Server name has changed ?

This is customized activity. you need to write a code/EXE which should triggered by user after server name has change.


这篇关于如果服务器名称更改,则连接字符串会自动更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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