Re: SocketException from code not caught in try catch or Application_Error

Tech-Archive recommends: Fix windows errors by optimizing your registry



The AppPool Identity for the site in question is already a domain account is this the setting you meant.

Consider this closed as I've moved onto an alternative solution, not perfect but it works.
Steven Cheng[MSFT] wrote:
Hi MC,

It is also likely that there is something related to the account running the application. Is there any proxy that requires to visit the certain remote server/site? You can try switch the ASP.NET process to a domain account to see whether it works.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------

Date: Tue, 18 Dec 2007 17:26:43 +0000
From: mc <mc@xxxxxxxxxxxxxxxx>
Newsgroups: microsoft.public.dotnet.framework.aspnet
Subject: Re: SocketException from code not caught in try catch or

Application_Error

No change! still broke.
Aidy wrote:

It might be something to do with the fact that you're using "using"

inside a

try block. Try it without the "using".

"mc" <mc@xxxxxxxxxxxxxxxx> wrote in message news:4767d662$1@xxxxxxxxxxxxxxxxxxxx


I have a function (shown below) that I call to check if a server is present. when a server is present, everything is ok. however when it

fails.

I get an SocketException fired. On my development machine all seems to

work

and the exception is fired and caught. however on my production server

the

exception fires, it's not caught by the try catch and it's also not

caught

in my application_error handler in Global.asax. Can anyone shed any

light

on this?

private bool CheckServer(string p){
try{
using (Socket s = new Socket(AddressFamily.Internetwork, SocketType.Stream, ProtocolType.Tcp)){
IPEndPoint iep = new

IPEndPoint(DNS.GetHostEntry(p).AddressList[0],

80);
s.Connect(iep);
return true;
}
}
catch{
return false;
}
}

TIA


MC




.