472,975 Members | 1,800 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,975 software developers and data experts.

Windows Service config file

..NET 3.5

I have a Windows Service application and it does remoting,
but when a client incounters an error the client get the following error
message

"Server encountered an internal error. For more information, turn off
customErrors in the server's .config file."

Where do I turn this off

I have found the following statement but where do I put this statement,
client? server ? I have tried both but still getting the same error message

RemotingConfiguration.CustomErrorsMode

Thank You

Peter
Jun 27 '08 #1
14 5500
On Apr 22, 10:59*am, "Peter" <czu...@nospam.nospamwrote:
.NET 3.5

I have a Windows Service application and it does remoting,
but when a client incounters an error the client get the following error
message

"Server encountered an internal error. For more information, turn off
customErrors in the server's .config file."

Where do I turn this off
IIRC the config file of the web app.
Jun 27 '08 #2
What does this mean "IIRC the config file of the web app." ?
This is what I have in my app.comfig file, but the client is still getting
the same error message.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.runtime.remoting>
<customErrors mode="Off"/>
</system.runtime.remoting>
</configuration>
"Ignacio Machin ( .NET/ C# MVP )" <ig************@gmail.comwrote in
message
news:00**********************************@x41g2000 hsb.googlegroups.com...
On Apr 22, 10:59 am, "Peter" <czu...@nospam.nospamwrote:
.NET 3.5

I have a Windows Service application and it does remoting,
but when a client incounters an error the client get the following error
message

"Server encountered an internal error. For more information, turn off
customErrors in the server's .config file."

Where do I turn this off
IIRC the config file of the web app.
Jun 27 '08 #3
On Apr 22, 4:50*pm, "Peter" <czu...@nospam.nospamwrote:
What does this mean "IIRC the config file of the web app." ?
If I Remember Correctly

You have to set the same tag but inside <system.web>

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
Jun 27 '08 #4
"Ignacio Machin ( .NET/ C# MVP )" <ig************@gmail.comwrote in
message
news:1f**********************************@e39g2000 hsf.googlegroups.com...
On Apr 22, 4:50 pm, "Peter" <czu...@nospam.nospamwrote:
What does this mean "IIRC the config file of the web app." ?
If I Remember Correctly

You have to set the same tag but inside <system.web>

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>

The OP is not talking about a Web service but about a Windows service
exposing remoting endpoints.

Willy.

Jun 27 '08 #5
"Peter" <cz****@nospam.nospamwrote in message
news:%2******************@TK2MSFTNGP06.phx.gbl...
What does this mean "IIRC the config file of the web app." ?
This is what I have in my app.comfig file, but the client is still getting
the same error message.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.runtime.remoting>
<customErrors mode="Off"/>
</system.runtime.remoting>
</configuration>

From above, it looks like your remoting server is not using a config file.
When you don't use a config file to configure your remoting services and
channels, you'll have to set the customError mode in code by calling
RemotingConfiguration.CustomErrorsEnabled.

Willy.
Jun 27 '08 #6
"Peter" <cz****@nospam.nospamwrote in message
news:O7**************@TK2MSFTNGP05.phx.gbl...
>I am using a Windows service with remoting

and I have tried both app.config file - where app = applicationname.exe
and I have tried RemotingConfiguration.CustomErrorsEnabled on the client
side and still getting the same error on the client.

My application name is ReportsService.exe
and the config file is ReportsService.exe.config

But this doesn't answer the question whether you are using a Config file or
whether you are explicitly configuring the services and channels in code. I
would love to see the code that initializes the server side of your remoting
service.
Also, what's the exact error message received by the client when _the_ error
occurs?
Willy.

Jun 27 '08 #7
Here's the error message on the client sided

"Server encountered an internal error. For more information, turn off
customErrors in the server's .config file."

Here's the conde on the Server side.

namespace ReportsService
{
public partial class ReportService : ServiceBase
{
private TcpChannel _objChannel = null;

private const int INT_DEFAULT_PORT = 8000;
private const string STR_DEFAULT_NAME = "ReportsServer.tcp";

public ReportService()
{
InitializeComponent();
}

protected override void OnStart(string[] args)
{
RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;
// Create the TcpChannel
this._objChannel = new TcpChannel(INT_DEFAULT_PORT);
ChannelServices.RegisterChannel(this._objChannel, false);

// Register the Proxy class for remoting.
RemotingConfiguration.RegisterWellKnownServiceType (
typeof(Report),
STR_DEFAULT_NAME,
WellKnownObjectMode.Singleton);

}

protected override void OnStop()
{
ChannelServices.UnregisterChannel(this._objChannel );
}
}
}

"Willy Denoyette [MVP]" <wi*************@telenet.bewrote in message
news:uh**************@TK2MSFTNGP05.phx.gbl...
"Peter" <cz****@nospam.nospamwrote in message
news:O7**************@TK2MSFTNGP05.phx.gbl...
>>I am using a Windows service with remoting

and I have tried both app.config file - where app = applicationname.exe
and I have tried RemotingConfiguration.CustomErrorsEnabled on the client
side and still getting the same error on the client.

My application name is ReportsService.exe
and the config file is ReportsService.exe.config


But this doesn't answer the question whether you are using a Config file
or whether you are explicitly configuring the services and channels in
code. I would love to see the code that initializes the server side of
your remoting service.
Also, what's the exact error message received by the client when _the_
error occurs?
Willy.

Jun 27 '08 #8
Hi Peter,

Based on the code snippet you provided, you have used the following code
to set the CustomErrorMode on server:

RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;

Didn't it work?

Based on my understanding, there are two means to set Custom Error mode for
remoting service:

1. Programmatically set it via code, just like the code you provided, you
can set RemotingConfiguration.CustomErrorsMode at initialization time.

2. You can also use configuration file to set the custom error mode. e.g.

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

However, you need to make sure you've called the following method so as to
tell the remoting runtime to load configuration from the app.config file:

=============
static void Init()
{
Console.WriteLine("Init........................... ");

//here SimpleRemotingSln.ServerApp.exe is my server appliation's exe file
name.
RemotingConfiguration.Configure("SimpleRemotingSln .ServerApp.exe.config");
.........
============

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

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

--------------------
>From: "Peter" <cz****@nospam.nospam>
References: <Oo**************@TK2MSFTNGP04.phx.gbl>
<00**********************************@x41g2000hsb. googlegroups.com>
<#0**************@TK2MSFTNGP06.phx.gbl>
<Oy*************@TK2MSFTNGP02.phx.gbl>
<O7**************@TK2MSFTNGP05.phx.gbl>
<uh**************@TK2MSFTNGP05.phx.gbl>
>Subject: Re: Windows Service config file
Date: Tue, 22 Apr 2008 21:12:36 -0500

Here's the error message on the client sided

"Server encountered an internal error. For more information, turn off
customErrors in the server's .config file."

Here's the conde on the Server side.

namespace ReportsService
{
public partial class ReportService : ServiceBase
{
private TcpChannel _objChannel = null;

private const int INT_DEFAULT_PORT = 8000;
private const string STR_DEFAULT_NAME = "ReportsServer.tcp";

public ReportService()
{
InitializeComponent();
}

protected override void OnStart(string[] args)
{
RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;
// Create the TcpChannel
this._objChannel = new TcpChannel(INT_DEFAULT_PORT);
ChannelServices.RegisterChannel(this._objChannel, false);

// Register the Proxy class for remoting.
RemotingConfiguration.RegisterWellKnownServiceType (
typeof(Report),
STR_DEFAULT_NAME,
WellKnownObjectMode.Singleton);

}

protected override void OnStop()
{
ChannelServices.UnregisterChannel(this._objChannel );
}
}
}

"Willy Denoyette [MVP]" <wi*************@telenet.bewrote in message
news:uh**************@TK2MSFTNGP05.phx.gbl...
>"Peter" <cz****@nospam.nospamwrote in message
news:O7**************@TK2MSFTNGP05.phx.gbl...
>>>I am using a Windows service with remoting

and I have tried both app.config file - where app = applicationname.exe
and I have tried RemotingConfiguration.CustomErrorsEnabled on the
client
>>side and still getting the same error on the client.

My application name is ReportsService.exe
and the config file is ReportsService.exe.config


But this doesn't answer the question whether you are using a Config file
or whether you are explicitly configuring the services and channels in
code. I would love to see the code that initializes the server side of
your remoting service.
Also, what's the exact error message received by the client when _the_
error occurs?
Willy.


Jun 27 '08 #9
RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;
or
RemotingConfiguration.Configure("ReportsServer.exe .config");

does not make any difference.
the client still is getting
"Server encountered an internal error. For more information, turn off
customErrors in the server's .config file."
I have tried to compile in Debug and Release and it did not make any
difference.

I know for a fact that the lines below get executed because I set the port
number in the same method.

RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;
or
RemotingConfiguration.Configure("ReportsServer.exe .config");
"Steven Cheng [MSFT]" <st*****@online.microsoft.comwrote in message
news:EK**************@TK2MSFTNGHUB02.phx.gbl...
Hi Peter,

Based on the code snippet you provided, you have used the following code
to set the CustomErrorMode on server:

RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;

Didn't it work?

Based on my understanding, there are two means to set Custom Error mode
for
remoting service:

1. Programmatically set it via code, just like the code you provided, you
can set RemotingConfiguration.CustomErrorsMode at initialization time.

2. You can also use configuration file to set the custom error mode. e.g.

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

However, you need to make sure you've called the following method so as to
tell the remoting runtime to load configuration from the app.config file:

=============
static void Init()
{
Console.WriteLine("Init........................... ");

//here SimpleRemotingSln.ServerApp.exe is my server appliation's exe file
name.
RemotingConfiguration.Configure("SimpleRemotingSln .ServerApp.exe.config");
........
============

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

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

--------------------
>>From: "Peter" <cz****@nospam.nospam>
References: <Oo**************@TK2MSFTNGP04.phx.gbl>
<00**********************************@x41g2000hsb. googlegroups.com>
<#0**************@TK2MSFTNGP06.phx.gbl>
<Oy*************@TK2MSFTNGP02.phx.gbl>
<O7**************@TK2MSFTNGP05.phx.gbl>
<uh**************@TK2MSFTNGP05.phx.gbl>
>>Subject: Re: Windows Service config file
Date: Tue, 22 Apr 2008 21:12:36 -0500

Here's the error message on the client sided

"Server encountered an internal error. For more information, turn off
customErrors in the server's .config file."

Here's the conde on the Server side.

namespace ReportsService
{
public partial class ReportService : ServiceBase
{
private TcpChannel _objChannel = null;

private const int INT_DEFAULT_PORT = 8000;
private const string STR_DEFAULT_NAME = "ReportsServer.tcp";

public ReportService()
{
InitializeComponent();
}

protected override void OnStart(string[] args)
{
RemotingConfiguration.CustomErrorsMode =
CustomErrorsModes.Off;
// Create the TcpChannel
this._objChannel = new TcpChannel(INT_DEFAULT_PORT);
ChannelServices.RegisterChannel(this._objChannel, false);

// Register the Proxy class for remoting.
RemotingConfiguration.RegisterWellKnownServiceType (
typeof(Report),
STR_DEFAULT_NAME,
WellKnownObjectMode.Singleton);

}

protected override void OnStop()
{
ChannelServices.UnregisterChannel(this._objChannel );
}
}
}

"Willy Denoyette [MVP]" <wi*************@telenet.bewrote in message
news:uh**************@TK2MSFTNGP05.phx.gbl...
>>"Peter" <cz****@nospam.nospamwrote in message
news:O7**************@TK2MSFTNGP05.phx.gbl...
I am using a Windows service with remoting

and I have tried both app.config file - where app = applicationname.exe
and I have tried RemotingConfiguration.CustomErrorsEnabled on the
client
>>>side and still getting the same error on the client.

My application name is ReportsService.exe
and the config file is ReportsService.exe.config

But this doesn't answer the question whether you are using a Config file
or whether you are explicitly configuring the services and channels in
code. I would love to see the code that initializes the server side of
your remoting service.
Also, what's the exact error message received by the client when _the_
error occurs?
Willy.



Jun 27 '08 #10
"Peter" <cz****@nospam.nospamwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;
or
RemotingConfiguration.Configure("ReportsServer.exe .config");

does not make any difference.
the client still is getting
"Server encountered an internal error. For more information, turn off
customErrors in the server's .config file."
I have tried to compile in Debug and Release and it did not make any
difference.

I know for a fact that the lines below get executed because I set the port
number in the same method.

RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;
or
RemotingConfiguration.Configure("ReportsServer.exe .config");
"Steven Cheng [MSFT]" <st*****@online.microsoft.comwrote in message
news:EK**************@TK2MSFTNGHUB02.phx.gbl...
>Hi Peter,

Based on the code snippet you provided, you have used the following code
to set the CustomErrorMode on server:

RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;

Didn't it work?

Based on my understanding, there are two means to set Custom Error mode
for
remoting service:

1. Programmatically set it via code, just like the code you provided, you
can set RemotingConfiguration.CustomErrorsMode at initialization time.

2. You can also use configuration file to set the custom error mode. e.g.

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

However, you need to make sure you've called the following method so as
to
tell the remoting runtime to load configuration from the app.config file:

=============
static void Init()
{
Console.WriteLine("Init........................... ");

//here SimpleRemotingSln.ServerApp.exe is my server appliation's exe file
name.
RemotingConfiguration.Configure("SimpleRemotingSl n.ServerApp.exe.config");
........
============

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you.
Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

================================================= =
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

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

--------------------
>>>From: "Peter" <cz****@nospam.nospam>
References: <Oo**************@TK2MSFTNGP04.phx.gbl>
<00**********************************@x41g2000hsb .googlegroups.com>
<#0**************@TK2MSFTNGP06.phx.gbl>
<Oy*************@TK2MSFTNGP02.phx.gbl>
<O7**************@TK2MSFTNGP05.phx.gbl>
<uh**************@TK2MSFTNGP05.phx.gbl>
>>>Subject: Re: Windows Service config file
Date: Tue, 22 Apr 2008 21:12:36 -0500

Here's the error message on the client sided

"Server encountered an internal error. For more information, turn off
customErrors in the server's .config file."

Here's the conde on the Server side.

namespace ReportsService
{
public partial class ReportService : ServiceBase
{
private TcpChannel _objChannel = null;

private const int INT_DEFAULT_PORT = 8000;
private const string STR_DEFAULT_NAME = "ReportsServer.tcp";

public ReportService()
{
InitializeComponent();
}

protected override void OnStart(string[] args)
{
RemotingConfiguration.CustomErrorsMode =
CustomErrorsModes.Off;
// Create the TcpChannel
this._objChannel = new TcpChannel(INT_DEFAULT_PORT);
ChannelServices.RegisterChannel(this._objChannel, false);

// Register the Proxy class for remoting.
RemotingConfiguration.RegisterWellKnownServiceType (
typeof(Report),
STR_DEFAULT_NAME,
WellKnownObjectMode.Singleton);

}

protected override void OnStop()
{
ChannelServices.UnregisterChannel(this._objChannel );
}
}
}

"Willy Denoyette [MVP]" <wi*************@telenet.bewrote in message
news:uh**************@TK2MSFTNGP05.phx.gbl...
"Peter" <cz****@nospam.nospamwrote in message
news:O7**************@TK2MSFTNGP05.phx.gbl...
>I am using a Windows service with remoting
>
and I have tried both app.config file - where app =
applicationname.exe
and I have tried RemotingConfiguration.CustomErrorsEnabled on the
client
>>>>side and still getting the same error on the client.
>
My application name is ReportsService.exe
and the config file is ReportsService.exe.config
>
But this doesn't answer the question whether you are using a Config
file
or whether you are explicitly configuring the services and channels in
code. I would love to see the code that initializes the server side of
your remoting service.
Also, what's the exact error message received by the client when _the_
error occurs?
Willy.




What is the value returned by CustomErrorsEnabled when called after the
after setting the CustomErrorsMode to Off?

....
RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;
bool customErrors = RemotingConfiguration.CustomErrorsEnabled(false);
// customErrors should be 'false', remote callers should get full exception
info including stack trace.....
....

Willy.

Jun 27 '08 #11

"Willy Denoyette [MVP]" <wi*************@telenet.bewrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
"Peter" <cz****@nospam.nospamwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
>RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;
or
RemotingConfiguration.Configure("ReportsServer.ex e.config");

does not make any difference.
the client still is getting
"Server encountered an internal error. For more information, turn off
customErrors in the server's .config file."
I have tried to compile in Debug and Release and it did not make any
difference.

I know for a fact that the lines below get executed because I set the
port number in the same method.

RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;
or
RemotingConfiguration.Configure("ReportsServer.ex e.config");
"Steven Cheng [MSFT]" <st*****@online.microsoft.comwrote in message
news:EK**************@TK2MSFTNGHUB02.phx.gbl...
>>Hi Peter,

Based on the code snippet you provided, you have used the following
code
to set the CustomErrorMode on server:

RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;

Didn't it work?

Based on my understanding, there are two means to set Custom Error mode
for
remoting service:

1. Programmatically set it via code, just like the code you provided,
you
can set RemotingConfiguration.CustomErrorsMode at initialization time.

2. You can also use configuration file to set the custom error mode.
e.g.

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

However, you need to make sure you've called the following method so as
to
tell the remoting runtime to load configuration from the app.config
file:

=============
static void Init()
{
Console.WriteLine("Init........................... ");

//here SimpleRemotingSln.ServerApp.exe is my server appliation's exe
file
name.
RemotingConfiguration.Configure("SimpleRemotingS ln.ServerApp.exe.config");
........
============

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments
and
suggestions about how we can improve the support we provide to you.
Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

================================================ ==
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

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

--------------------
From: "Peter" <cz****@nospam.nospam>
References: <Oo**************@TK2MSFTNGP04.phx.gbl>
<00**********************************@x41g2000hs b.googlegroups.com>
<#0**************@TK2MSFTNGP06.phx.gbl>
<Oy*************@TK2MSFTNGP02.phx.gbl>
<O7**************@TK2MSFTNGP05.phx.gbl>
<uh**************@TK2MSFTNGP05.phx.gbl>
Subject: Re: Windows Service config file
Date: Tue, 22 Apr 2008 21:12:36 -0500

Here's the error message on the client sided

"Server encountered an internal error. For more information, turn off
customErrors in the server's .config file."

Here's the conde on the Server side.

namespace ReportsService
{
public partial class ReportService : ServiceBase
{
private TcpChannel _objChannel = null;

private const int INT_DEFAULT_PORT = 8000;
private const string STR_DEFAULT_NAME = "ReportsServer.tcp";

public ReportService()
{
InitializeComponent();
}

protected override void OnStart(string[] args)
{
RemotingConfiguration.CustomErrorsMode =
CustomErrorsModes.Off;
// Create the TcpChannel
this._objChannel = new TcpChannel(INT_DEFAULT_PORT);
ChannelServices.RegisterChannel(this._objChannel, false);

// Register the Proxy class for remoting.
RemotingConfiguration.RegisterWellKnownServiceType (
typeof(Report),
STR_DEFAULT_NAME,
WellKnownObjectMode.Singleton);

}

protected override void OnStop()
{
ChannelServices.UnregisterChannel(this._objChannel );
}
}
}

"Willy Denoyette [MVP]" <wi*************@telenet.bewrote in message
news:uh**************@TK2MSFTNGP05.phx.gbl.. .
"Peter" <cz****@nospam.nospamwrote in message
news:O7**************@TK2MSFTNGP05.phx.gbl.. .
>>I am using a Windows service with remoting
>>
>and I have tried both app.config file - where app =
>applicationname.exe
>and I have tried RemotingConfiguration.CustomErrorsEnabled on the
client
>side and still getting the same error on the client.
>>
>My application name is ReportsService.exe
>and the config file is ReportsService.exe.config
>>
>
>
But this doesn't answer the question whether you are using a Config
file
or whether you are explicitly configuring the services and channels in
code. I would love to see the code that initializes the server side of
your remoting service.
Also, what's the exact error message received by the client when _the_
error occurs?
>
>
Willy.
>



What is the value returned by CustomErrorsEnabled when called after the
after setting the CustomErrorsMode to Off?

...
RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;
bool customErrors = RemotingConfiguration.CustomErrorsEnabled(false);
// customErrors should be 'false', remote callers should get full
exception info including stack trace.....
...

Willy.
When I execute the following on the client side the customErrors returns
false :

RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;
bool customErrors = RemotingConfiguration.CustomErrorsEnabled(false);

Jun 27 '08 #12
"Peter" <cz****@nospam.nospamwrote in message
news:e0**************@TK2MSFTNGP04.phx.gbl...
>
"Willy Denoyette [MVP]" <wi*************@telenet.bewrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
>"Peter" <cz****@nospam.nospamwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
>>RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;
or
RemotingConfiguration.Configure("ReportsServer.e xe.config");

does not make any difference.
the client still is getting
"Server encountered an internal error. For more information, turn off
customErrors in the server's .config file."
I have tried to compile in Debug and Release and it did not make any
difference.

I know for a fact that the lines below get executed because I set the
port number in the same method.

RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;
or
RemotingConfiguration.Configure("ReportsServer.e xe.config");
"Steven Cheng [MSFT]" <st*****@online.microsoft.comwrote in message
news:EK**************@TK2MSFTNGHUB02.phx.gbl.. .
Hi Peter,

Based on the code snippet you provided, you have used the following
code
to set the CustomErrorMode on server:

RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;

Didn't it work?

Based on my understanding, there are two means to set Custom Error mode
for
remoting service:

1. Programmatically set it via code, just like the code you provided,
you
can set RemotingConfiguration.CustomErrorsMode at initialization time.

2. You can also use configuration file to set the custom error mode.
e.g.

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

However, you need to make sure you've called the following method so as
to
tell the remoting runtime to load configuration from the app.config
file:

=============
static void Init()
{
Console.WriteLine("Init........................... ");

//here SimpleRemotingSln.ServerApp.exe is my server appliation's exe
file
name.
RemotingConfiguration.Configure("SimpleRemoting Sln.ServerApp.exe.config");
........
============

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments
and
suggestions about how we can improve the support we provide to you.
Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

=============================================== ===
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

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

--------------------
>From: "Peter" <cz****@nospam.nospam>
>References: <Oo**************@TK2MSFTNGP04.phx.gbl>
<00**********************************@x41g2000h sb.googlegroups.com>
<#0**************@TK2MSFTNGP06.phx.gbl>
<Oy*************@TK2MSFTNGP02.phx.gbl>
<O7**************@TK2MSFTNGP05.phx.gbl>
<uh**************@TK2MSFTNGP05.phx.gbl>
>Subject: Re: Windows Service config file
>Date: Tue, 22 Apr 2008 21:12:36 -0500
>
>Here's the error message on the client sided
>
>"Server encountered an internal error. For more information, turn off
>customErrors in the server's .config file."
>
>Here's the conde on the Server side.
>
>namespace ReportsService
>{
public partial class ReportService : ServiceBase
{
private TcpChannel _objChannel = null;
>
private const int INT_DEFAULT_PORT = 8000;
private const string STR_DEFAULT_NAME = "ReportsServer.tcp";
>
public ReportService()
{
InitializeComponent();
}
>
protected override void OnStart(string[] args)
{
RemotingConfiguration.CustomErrorsMode =
CustomErrorsModes.Off;
// Create the TcpChannel
this._objChannel = new TcpChannel(INT_DEFAULT_PORT);
ChannelServices.RegisterChannel(this._objChannel, false);
>
// Register the Proxy class for remoting.
RemotingConfiguration.RegisterWellKnownServiceType (
typeof(Report),
STR_DEFAULT_NAME,
WellKnownObjectMode.Singleton);
>
}
>
protected override void OnStop()
{
ChannelServices.UnregisterChannel(this._objChannel );
}
}
>}
>
>"Willy Denoyette [MVP]" <wi*************@telenet.bewrote in message
>news:uh**************@TK2MSFTNGP05.phx.gbl. ..
>"Peter" <cz****@nospam.nospamwrote in message
>news:O7**************@TK2MSFTNGP05.phx.gbl. ..
>>>I am using a Windows service with remoting
>>>
>>and I have tried both app.config file - where app =
>>applicationname.exe
>>and I have tried RemotingConfiguration.CustomErrorsEnabled on the
client
>>side and still getting the same error on the client.
>>>
>>My application name is ReportsService.exe
>>and the config file is ReportsService.exe.config
>>>
>>
>>
>But this doesn't answer the question whether you are using a Config
>file
>or whether you are explicitly configuring the services and channels
>in
>code. I would love to see the code that initializes the server side
>of
>your remoting service.
>Also, what's the exact error message received by the client when
>_the_
>error occurs?
>>
>>
>Willy.
>>
>
>
>

What is the value returned by CustomErrorsEnabled when called after the
after setting the CustomErrorsMode to Off?

...
RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;
bool customErrors = RemotingConfiguration.CustomErrorsEnabled(false);
// customErrors should be 'false', remote callers should get full
exception info including stack trace.....
...

Willy.

When I execute the following on the client side the customErrors returns
false :

RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;
bool customErrors = RemotingConfiguration.CustomErrorsEnabled(false);


You need to execute this at the server side! It makes no sense to do this on
the client, it's the server that sends error information to the client when
an error occurs.
Willy.

Jun 27 '08 #13

"Willy Denoyette [MVP]" <wi*************@telenet.bewrote in message
news:uA**************@TK2MSFTNGP04.phx.gbl...
"Peter" <cz****@nospam.nospamwrote in message
news:e0**************@TK2MSFTNGP04.phx.gbl...
>>
"Willy Denoyette [MVP]" <wi*************@telenet.bewrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
>>"Peter" <cz****@nospam.nospamwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl.. .
RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;
or
RemotingConfiguration.Configure("ReportsServer. exe.config");

does not make any difference.
the client still is getting
"Server encountered an internal error. For more information, turn off
customErrors in the server's .config file."
I have tried to compile in Debug and Release and it did not make any
difference.

I know for a fact that the lines below get executed because I set the
port number in the same method.

RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;
or
RemotingConfiguration.Configure("ReportsServer. exe.config");
"Steven Cheng [MSFT]" <st*****@online.microsoft.comwrote in message
news:EK**************@TK2MSFTNGHUB02.phx.gbl. ..
Hi Peter,
>
Based on the code snippet you provided, you have used the following
code
to set the CustomErrorMode on server:
>
RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;
>
Didn't it work?
>
Based on my understanding, there are two means to set Custom Error
mode for
remoting service:
>
1. Programmatically set it via code, just like the code you provided,
you
can set RemotingConfiguration.CustomErrorsMode at initialization time.
>
2. You can also use configuration file to set the custom error mode.
e.g.
>
==========
<system.runtime.remoting>
<customErrors mode="Off" />
..
==========
>
However, you need to make sure you've called the following method so
as to
tell the remoting runtime to load configuration from the app.config
file:
>
=============
static void Init()
{
Console.WriteLine("Init........................... ");
>
//here SimpleRemotingSln.ServerApp.exe is my server appliation's exe
file
name.
>
>
RemotingConfiguration.Configure("SimpleRemotin gSln.ServerApp.exe.config");
........
============
>
Sincerely,
>
Steven Cheng
>
Microsoft MSDN Online Support Lead
>
>
Delighting our customers is our #1 priority. We welcome your comments
and
suggestions about how we can improve the support we provide to you.
Please
feel free to let my manager know what you think of the level of
service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.
>
============================================== ====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
>
============================================== ====
This posting is provided "AS IS" with no warranties, and confers no
rights.
>
--------------------
>>From: "Peter" <cz****@nospam.nospam>
>>References: <Oo**************@TK2MSFTNGP04.phx.gbl>
<00**********************************@x41g2000 hsb.googlegroups.com>
<#0**************@TK2MSFTNGP06.phx.gbl>
<Oy*************@TK2MSFTNGP02.phx.gbl>
<O7**************@TK2MSFTNGP05.phx.gbl>
<uh**************@TK2MSFTNGP05.phx.gbl>
>>Subject: Re: Windows Service config file
>>Date: Tue, 22 Apr 2008 21:12:36 -0500
>>
>>Here's the error message on the client sided
>>
>>"Server encountered an internal error. For more information, turn off
>>customErrors in the server's .config file."
>>
>>Here's the conde on the Server side.
>>
>>namespace ReportsService
>>{
> public partial class ReportService : ServiceBase
> {
> private TcpChannel _objChannel = null;
>>
> private const int INT_DEFAULT_PORT = 8000;
> private const string STR_DEFAULT_NAME = "ReportsServer.tcp";
>>
> public ReportService()
> {
> InitializeComponent();
> }
>>
> protected override void OnStart(string[] args)
> {
> RemotingConfiguration.CustomErrorsMode =
>CustomErrorsModes.Off;
> // Create the TcpChannel
> this._objChannel = new TcpChannel(INT_DEFAULT_PORT);
> ChannelServices.RegisterChannel(this._objChannel, false);
>>
> // Register the Proxy class for remoting.
> RemotingConfiguration.RegisterWellKnownServiceType (
> typeof(Report),
> STR_DEFAULT_NAME,
> WellKnownObjectMode.Singleton);
>>
> }
>>
> protected override void OnStop()
> {
> ChannelServices.UnregisterChannel(this._objChannel );
> }
> }
>>}
>>
>>"Willy Denoyette [MVP]" <wi*************@telenet.bewrote in message
>>news:uh**************@TK2MSFTNGP05.phx.gbl.. .
>>"Peter" <cz****@nospam.nospamwrote in message
>>news:O7**************@TK2MSFTNGP05.phx.gbl.. .
>>>>I am using a Windows service with remoting
>>>>
>>>and I have tried both app.config file - where app =
>>>applicationname.exe
>>>and I have tried RemotingConfiguration.CustomErrorsEnabled on the
client
>>>side and still getting the same error on the client.
>>>>
>>>My application name is ReportsService.exe
>>>and the config file is ReportsService.exe.config
>>>>
>>>
>>>
>>But this doesn't answer the question whether you are using a Config
>>file
>>or whether you are explicitly configuring the services and channels
>>in
>>code. I would love to see the code that initializes the server side
>>of
>>your remoting service.
>>Also, what's the exact error message received by the client when
>>_the_
>>error occurs?
>>>
>>>
>>Willy.
>>>
>>
>>
>>
>

What is the value returned by CustomErrorsEnabled when called after the
after setting the CustomErrorsMode to Off?

...
RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;
bool customErrors = RemotingConfiguration.CustomErrorsEnabled(false);
// customErrors should be 'false', remote callers should get full
exception info including stack trace.....
...

Willy.

When I execute the following on the client side the customErrors returns
false :

RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;
bool customErrors = RemotingConfiguration.CustomErrorsEnabled(false);

You need to execute this at the server side! It makes no sense to do this
on the client, it's the server that sends error information to the client
when an error occurs.
Willy.
Thank You

executing bool customErrors =
RemotingConfiguration.CustomErrorsEnabled(false);
on the server side did the trick.
Jun 27 '08 #14
Hi Peter,

Yes, as Willy mentioned, generally the CustomErrorMode means the Mode on
server-side because that controls whether the detailed error info will be
output to client-side. Therefore, now your remoting application's custom
error should has been turned off and the exception info is the full info
come from server-side.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

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

--------------------
>From: "Peter" <cz****@nospam.nospam>
References: <Oo**************@TK2MSFTNGP04.phx.gbl>
<00**********************************@x41g2000hsb. googlegroups.com>
<#0h#<e0**************@TK2MSFTNGP04.phx.gbl>
<uA**************@TK2MSFTNGP04.phx.gbl>
>Subject: Re: Windows Service config file
Date: Wed, 23 Apr 2008 14:53:36 -0500
>

"Willy Denoyette [MVP]" <wi*************@telenet.bewrote in message
news:uA**************@TK2MSFTNGP04.phx.gbl...
>"Peter" <cz****@nospam.nospamwrote in message
news:e0**************@TK2MSFTNGP04.phx.gbl...
>>>
"Willy Denoyette [MVP]" <wi*************@telenet.bewrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl.. .
"Peter" <cz****@nospam.nospamwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl. ..
RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;
or
RemotingConfiguration.Configure("ReportsServer .exe.config");
>
does not make any difference.
the client still is getting
"Server encountered an internal error. For more information, turn off
customErrors in the server's .config file."
>
>
I have tried to compile in Debug and Release and it did not make any
difference.
>
I know for a fact that the lines below get executed because I set the
port number in the same method.
>
RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;
or
RemotingConfiguration.Configure("ReportsServer .exe.config");
>
>
"Steven Cheng [MSFT]" <st*****@online.microsoft.comwrote in message
news:EK**************@TK2MSFTNGHUB02.phx.gbl.. .
>Hi Peter,
>>
>Based on the code snippet you provided, you have used the following
>code
>to set the CustomErrorMode on server:
>>
>RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;
>>
>Didn't it work?
>>
>Based on my understanding, there are two means to set Custom Error
>mode for
>remoting service:
>>
>1. Programmatically set it via code, just like the code you
provided,
>>>>>you
>can set RemotingConfiguration.CustomErrorsMode at initialization
time.
>>>>>>
>2. You can also use configuration file to set the custom error mode.
>e.g.
>>
>==========
><system.runtime.remoting>
> <customErrors mode="Off" />
>..
>==========
>>
>However, you need to make sure you've called the following method so
>as to
>tell the remoting runtime to load configuration from the app.config
>file:
>>
>=============
> static void Init()
> {
> Console.WriteLine("Init........................... ");
>>
>//here SimpleRemotingSln.ServerApp.exe is my server appliation's exe
>file
>name.
>>
>>
>>
RemotingConfiguration.Configure("SimpleRemotingSln .ServerApp.exe.config");
>>>>>........
>============
>>
>S
Jun 27 '08 #15

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: | last post by:
Hi, I have a Windows Service that uses a referenced dotnet-dll. In my dll I set some public string to a stringvalue that I get from reading a xml-file(my config file). It works fine if I use it...
1
by: Vlad | last post by:
Is there any way to install multiple instances of the same windows service designed with VS.NET 2003? I tried copying the binaries into a separate folder and then copying registry entries for the...
4
by: TomB | last post by:
I've written a simple service that reads the app.config file on start. It works fine if I start it from the VS IDE -- F5 then installutil I then created a package, wherein the content of...
2
by: Bill | last post by:
I've created a windows service in C#, but I'm having trouble reading <appSettings> from a app.config file. I can read <appSettings> just fine from a normal C# windows app, so there must be some...
2
by: Trevor | last post by:
Argh! This problem is driving me nuts! Can you help? In November of 2003, I installed a web service on Windows Server 2003 built in VB.NET for v1.1.4322 of the framework. It contains a timer...
4
by: PeterW | last post by:
I have a Windows service that needs to get some values from a config file. I place the config file for the service in the System32 directory. I do not get the values using the usual...
1
by: noah.blumenthal | last post by:
I wrote a windows service in c# (applause) and now I want to add the ability to edit its settings. Basically this service checks an email account at certain intervals and forwards the emails to...
0
by: =?Utf-8?B?U2ltb25EZXY=?= | last post by:
Hi All I would like to install the same Windows Service project on the same server under different names, one for each customer. I have been able to do it but I would like an expert opinion as...
1
by: =?Utf-8?B?TWFuanJlZSBHYXJn?= | last post by:
Hi, I created a web service that I want to host in windows service. The problem is that if I host it as windows service it does not use the configuration file. I have to define the binding,...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.