Groups | Blog | Home
all groups > dotnet remoting > april 2006 >

dotnet remoting : remoting excpetions


msuk
4/6/2006 7:21:02 AM
All,

I have a remote server that my client calls running on two separate PC's.
On my remote sever I have a method that returns a ADO.Net Dataset that has a
try and catch block around it. Now if for example I cause an exception by
using an incorrect connection string I would like to throw the error back to
my client - how can I do this?

Currently I am doing the following:

private void getDataSet(string storedProcName, string tableName,DataSet
himData)
{
SqlConnection myConnection = new
SqlConnection(Configuration.ConnectionInfo);
// Create a SqlDataAdapter.
SqlDataAdapter myAdapter = new SqlDataAdapter();

try
{
myConnection.Open();
SqlCommand myCommand = new SqlCommand(storedProcName,myConnection);
myCommand.CommandType = CommandType.StoredProcedure;
myAdapter.SelectCommand = myCommand;
myAdapter.Fill(xxxx,tableName);
myConnection.Close();
}
catch (Exception ex)
{

throw ex;
}
finally
{
this.closeDBConnection(myConnection);
}

}

At the client end I am getting the following message for the exception:

“Server encountered an internal error. For more information, turn on
customErrors in the server’s .config file.” Using this information I looked
up the customErrors element in the online help and put together the following
..config file.

I am using a config file and have the following element:

<system.runtime.remoting>
<customErrors mode="off"/>
..............................

Thanks
msuk
4/10/2006 9:10:02 AM
Hi,

Can anyone please help me - I still cant get the exception on my client.

Thanks
Msuk

[quoted text, click to view]
Udo Nesshoever
4/11/2006 5:50:40 PM
[quoted text, click to view]

Did you actually try to google?

This search http://tinyurl.com/z9upa produced among others:
http://www.c-sharpcorner.com/Code/2003/Nov/RemotingEvents.asp
http://www.dotnetspider.com/kb/Article565.aspx

Both samples com with source code.

HTH

Cheers,
AddThis Social Bookmark Button