Hi Peter,
Based on the code snippet you provided, you have used the following code
to set the CustomErrorMode on server:
RemotingConfigu ration.CustomEr rorsMode = CustomErrorsMod es.Off;
Didn't it work?
Based on my understanding, there are two means to set Custom Error mode for
remoting service:
1. Programmaticall y set it via code, just like the code you provided, you
can set RemotingConfigu ration.CustomEr rorsMode 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.WriteLi ne("Init....... ............... .....");
//here SimpleRemotingS ln.ServerApp.ex e is my server appliation's exe file
name.
RemotingConfigu ration.Configur e("SimpleRemoti ngSln.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****@microsof t.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************ *************** *******@x41g200 0hsb.googlegrou ps.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_POR T = 8000;
private const string STR_DEFAULT_NAM E = "ReportsServer. tcp";
public ReportService()
{
InitializeCompo nent();
}
protected override void OnStart(string[] args)
{
RemotingConfigu ration.CustomEr rorsMode = CustomErrorsMod es.Off;
// Create the TcpChannel
this._objChanne l = new TcpChannel(INT_ DEFAULT_PORT);
ChannelServices .RegisterChanne l(this._objChan nel, false);
// Register the Proxy class for remoting.
RemotingConfigu ration.Register WellKnownServic eType(
typeof(Report),
STR_DEFAULT_NAM E,
WellKnownObject Mode.Singleton) ;
}
protected override void OnStop()
{
ChannelServices .UnregisterChan nel(this._objCh annel);
}
}
}
"Willy Denoyette [MVP]" <wi************ *@telenet.bewro te in message
news:uh******* *******@TK2MSFT NGP05.phx.gbl.. .
>"Peter" <cz****@nospam. nospamwrote in message
news:O7******* *******@TK2MSFT NGP05.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 RemotingConfigu ration.CustomEr rorsEnabled 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.