检查数据库服务器是否可用 [英] Check if database server is available
本文介绍了检查数据库服务器是否可用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
我想检查我的代码中数据库服务器是否可用.
我正在使用asp.net C#4.0
谢谢
Hello,
I want to check if database server is available or not in my code.
I am using asp.net C# 4.0
Thank you
推荐答案
要检查服务器是否可用,可以使用Ping
来查看服务器地址是否存在(这仅在ping未被阻止的情况下有效通过防火墙): http://msdn.microsoft.com/zh-CN /library/system.net.networkinformation.ping.aspx [ ^ ]
查看数据库引擎是否在服务器上工作的唯一真实方法是尝试连接到服务器.
To check if a server is available you can usePing
to see if the server address exists (this will only work if ping has not been blocked by a firewall) : http://msdn.microsoft.com/en-us/library/system.net.networkinformation.ping.aspx[^]
The only real way to see if the database engine is working on a server is try to connect to it.
这篇关于检查数据库服务器是否可用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文