473,769 Members | 2,141 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

RemotingConfigu ration.CustomEr rorsMode

Thank You

Peter
Jun 27 '08 #1
14 5622
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" ?>
<configuratio n>
<system.runtime .remoting>
<customErrors mode="Off"/>
</system.runtime. remoting>
</configuration>
"Ignacio Machin ( .NET/ C# MVP )" <ig************ @gmail.comwrote in
message
news:00******** *************** ***********@x41 g2000hsb.google groups.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" ?>
<configuratio n>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
Jun 27 '08 #4
"Ignacio Machin ( .NET/ C# MVP )" <ig************ @gmail.comwrote in
message
news:1f******** *************** ***********@e39 g2000hsf.google groups.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" ?>
<configuratio n>
<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******** **********@TK2M SFTNGP06.phx.gb l...
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" ?>
<configuratio n>
<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
RemotingConfigu ration.CustomEr rorsEnabled.

Willy.
Jun 27 '08 #6
"Peter" <cz****@nospam. nospamwrote in message
news:O7******** ******@TK2MSFTN GP05.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.

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_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******** ******@TK2MSFTN GP05.phx.gbl...
"Peter" <cz****@nospam. nospamwrote in message
news:O7******** ******@TK2MSFTN GP05.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.

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:

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.


Jun 27 '08 #9
RemotingConfigu ration.CustomEr rorsMode = CustomErrorsMod es.Off;
or
RemotingConfigu ration.Configur e("ReportsServe r.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.

RemotingConfigu ration.CustomEr rorsMode = CustomErrorsMod es.Off;
or
RemotingConfigu ration.Configur e("ReportsServe r.exe.config");
"Steven Cheng [MSFT]" <st*****@online .microsoft.comw rote in message
news:EK******** ******@TK2MSFTN GHUB02.phx.gbl. ..
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
customError s 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 =
CustomErrorsMo des.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****** ********@TK2MSF TNGP05.phx.gbl. ..
>>"Peter" <cz****@nospam. nospamwrote in message
news:O7****** ********@TK2MSF TNGP05.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.



Jun 27 '08 #10

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

Similar topics

5
6750
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 in a vb-form. But since Windows Services ? executes? in windows\system32 I canīt locate my xml-config- file. I donīt want to set different "compiling-statements" such as :
1
6003
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 original service under a new name but the SCM complains that the executable does not have this service implemented. Please note that I need to have distinct instances of executables installed not merely multiple windows services defined within...
4
17080
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 app.config has "" for the values. With the idea that my user, can enter the information before starting the service. However; this doesn't work. I'm very confused. As a test, I "emptied" the app.config file and rebuilt, then did an installutil. ...
2
2496
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 trick to read this file from a windows service, yes? perhaps the location of the .config file? any help is appreciated... -bill
2
2460
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 (System.Timers.Timer) which has an interval of 24 hours. Actually, it reads a time like 2AM out of the config file, and calculates the time between the start of the service to 2AM, and sets the timer. When the timer expires, it re-reads the...
4
22542
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 ConfigurationSettings.AppSettings Any tips please cheers -- PeterW
1
5449
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 another email address. I want to be able to configure how often it runs (it uses a timer, so setting the interval for that timer is what I mean by that statement) and what account to check and what email address to send to. Seems easy, right? ...
0
2699
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 to whether my solution is robust or whether there is a better way to do it. What I've been trying to do is to create a core project with different extension projects, one for each customer. I wanted to create a different Setup project for each...
1
2086
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, endpoint etc. programmatically in the Program.cs file. Any idea what I might be doing wrong? Cheers,
0
9416
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10199
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10035
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9981
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9850
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5293
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3948
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3551
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2810
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.