Click here to Skip to main content
15,886,810 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have a .Net library which checks if a WCF service is up and running. Below is the function I have used.

 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();

I have called the same in NISSI using CLR::Call
         CLR::Call /NOUNLOAD "TestService.dll" "TestService.MyClass"  "VerifySiteExists" 1 "https://axx.xx.com/xx/yyy.svc"

But it gives me the error- "Exception has been thrown by target invocation. .

Kindly advice.

Thanks


What I have tried:

I have noticed that it is because of the .Net class HttpWebRequest. If I comment those functions and return a simple "Hello World" string, it works fine. I need to implement another function that needs to connect to SQL db to check if a data exists in a table. Both these cases , I am facing the same issue.
Posted
Comments
F-ES Sitecore 4-Jul-19 6:43am    
I'd probably start by using a network monitor like fiddler or wireshark to examine the network call to see if anything stands out. Sometimes a more detailed error message is included in the response as those tools will show that.
Divya B Nair 4-Jul-19 6:52am    
There are certain limitations in calling a .Net library from NSIS. My intuition points to that. I am definitely sure that its not related to C# code as sideways I had implemented it as a Console application and found it working.
Mehdi Gholam 4-Jul-19 6:52am    
Check if your dll compiled processor type and your running process match.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900