开发者

How to change the hostname for the SQL server?

I moved a system 'asp.net' to another server and now I need to c开发者_如何学Pythonhange the hostname for the SQL server, but the <connectionStrings/>(web.config) is empty, where should I change?


It has to be somewhere or it would never have worked. You can grep/search for the connection string in your code, or you didn't actually move the config file.


You will need to change connection strings whereever they are present.

They might have been added in the appSettings section, or for state using SQL Server in the sessionState section.

It is possible that the connection strings have been put into a config file of their own - does the connectionStrings section have a configSource attribute? If so, that's where they would be found.

It is easy enough to search for Initial Catalog= or Server= within your config files.


If you have access to the code, then fire up notepad++ like editor and find the sqlconnection object.. there you will have the connection string or reading mechanism employed.


You might be able to do the following for a quick fix.

Modify the hosts file to point the old server name to the new IP address. This should work, unless the connection string has an IP address in it.

Also, you should check with other software to make sure the new database server is running properly. Just to be sure it's the application having the problem, and not the server.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜