Old 4th July 2019, 10:35   #1
DivyaArun
Junior Member
 
Join Date: Jul 2019
Posts: 30
.Net dll when called using CLR::Call giving exception

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. 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.

Kindly advice.

Thanks
DivyaArun is offline   Reply With Quote
Old 4th July 2019, 12:14   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,165
Duplicate of https://stackoverflow.com/questions/...-if-a-web-serv

NISSI?

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 5th July 2019, 03:54   #3
DivyaArun
Junior Member
 
Join Date: Jul 2019
Posts: 30
Sorry NSIS
DivyaArun is offline   Reply With Quote
Old 5th July 2019, 09:38   #4
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,165
Have you tried debugging? We need to know if the crash is in your code or the CLR plug-in...

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 8th July 2019, 09:03   #5
DivyaArun
Junior Member
 
Join Date: Jul 2019
Posts: 30
Quote:
Originally Posted by Anders View Post
Have you tried debugging? We need to know if the crash is in your code or the CLR plug-in...
Yes, I had confirmed that .Net code is working one. I presume the issue is related to the reference to System.Net.Http.dll.
DivyaArun is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Tags
clr

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump