我有一个.Net库,它检查WCF服务是否已启动并正在运行。 VerifySiteExists()用于检查它。我在NISSI中使用CLR :: Call
进行了调用CLR :: Call / NOUNLOAD“ TestService.dll”“ TestService.MyClass”“ VerifySiteExists” 1“ https://axx.xx.com/xx/yyy.svc”
但是它给我一个错误-“目标调用引发了异常。
我注意到这是因为.Net类HttpWebRequest。如果我注释这些函数并返回一个简单的“ Hello World”字符串,则可以正常工作。我需要实现另一个功能,该功能需要连接到SQL db以检查表中是否存在数据。这两种情况下,我都面临着同样的问题。
public string VerifySiteExists(string wcfurl)
{
HttpWebRequest httpReq = (HttpWebRequest)WebRequest.Create(wcfurl);
httpReq.AllowAutoRedirect = false;
HttpWebResponse httpRes = (HttpWebResponse)httpReq.GetResponse();
if (httpRes.StatusCode != HttpStatusCode.OK)
result = "OK";
httpRes.Close();
}
我想检查是否能够连接到WCF服务。因此,我使用了.Net dll。
请帮助。
谢谢