我有一个问题两天没能解决。
在控制台应用程序中,此代码可以正常工作:
url="http://www.reuters.com/finance/currencies/quote?srcAmt=1.00&srcCurr=USD&destAmt=&destCurr=ASD&historicalDate=MMddyyyy"
HttpWebRequest req = WebRequest.Create(url) as HttpWebRequest;
req.Timeout = 3000000;
using (HttpWebResponse resp = req.GetResponse() as HttpWebResponse)
{
// ...
}
但在我的 Windows 服务中,GetResponse()
抛出异常“无法解析远程名称:'www.reuters.com'”。
我不知道我做错了什么,也许我在ServiceInstaller
.
感谢您向我展示了正确的轨道,但还有一个问题。
我正在使用虚拟机(我有管理员权限,但我根本没有管理经验)。
如果我在服务安装程序中为用户设置帐户(并提供我的登录详细信息),那么我与数据库(Odbc)的连接有问题。连接打开抛出我:
ERROR [08001] [MERANT][ODBC Sybase driver]
Allocation of a Sybase Open Client Context failed.
Sybase normally generates a SYBINIT.ERR file containing more specific reasons for failing.\r\n
ERROR [01S00] [MERANT][ODBC Sybase driver]
Invalid attribute in connection string: Port.
因此,如果将 Account User 设置为ServiceInstaller
我无法连接到 DB,否则如果我将 Account 设置为 LocalSystem,我可以打开与 DB 的连接,但我无法使用GetResponse()
.
那么问题来了,当一切都放在 Windows 终端服务器上时,我该怎么办?
我想可能是管理员权限搞砸了。我能做些什么来解决这个问题?再次感谢。