Windows Service config file

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Peter

    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


  • Ignacio Machin ( .NET/ C# MVP )

    #2
    Re: Windows Service config file

    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.

    Comment

    • Peter

      #3
      Re: Windows Service config file

      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 )" <ignacio.machin @gmail.comwrote in
      message
      news:003eda0c-26fb-48f9-91c5-24dfc359d2a3@x4 1g2000hsb.googl egroups.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.


      Comment

      • Ignacio Machin ( .NET/ C# MVP )

        #4
        Re: Windows Service config file

        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>

        Comment

        • Willy Denoyette [MVP]

          #5
          Re: Windows Service config file

          "Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin @gmail.comwrote in
          message
          news:1f61165b-3f33-4c1f-b75d-c02c60fa8683@e3 9g2000hsf.googl egroups.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.

          Comment

          • Willy Denoyette [MVP]

            #6
            Re: Windows Service config file

            "Peter" <czupet@nospam. nospamwrote in message
            news:%230h%231p LpIHA.4760@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.


            Comment

            • Willy Denoyette [MVP]

              #7
              Re: Windows Service config file

              "Peter" <czupet@nospam. nospamwrote in message
              news:O75p$DNpIH A.4672@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.

              Comment

              • Peter

                #8
                Re: Windows Service config file

                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]" <willy.denoyett e@telenet.bewro te in message
                news:uhbX6TNpIH A.2068@TK2MSFTN GP05.phx.gbl...
                "Peter" <czupet@nospam. nospamwrote in message
                news:O75p$DNpIH A.4672@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.
                >

                Comment

                • Steven Cheng [MSFT]

                  #9
                  Re: Windows Service config file

                  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:
                  msdnmg@microsof t.com.

                  =============== =============== =============== =====
                  Get notification to my posts through email? Please refer to
                  Gain technical skills through documentation and training, earn certifications and connect with the community

                  ications.

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

                  --------------------
                  >From: "Peter" <czupet@nospam. nospam>
                  >References: <OoiI1lIpIHA.21 88@TK2MSFTNGP04 .phx.gbl>
                  <003eda0c-26fb-48f9-91c5-24dfc359d2a3@x4 1g2000hsb.googl egroups.com>
                  <#0h#1pLpIHA.47 60@TK2MSFTNGP06 .phx.gbl>
                  <OyjZyRMpIHA.67 2@TK2MSFTNGP02. phx.gbl>
                  <O75p$DNpIHA.46 72@TK2MSFTNGP05 .phx.gbl>
                  <uhbX6TNpIHA.20 68@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]" <willy.denoyett e@telenet.bewro te in message
                  >news:uhbX6TNpI HA.2068@TK2MSFT NGP05.phx.gbl.. .
                  >"Peter" <czupet@nospam. nospamwrote in message
                  >news:O75p$DNpI HA.4672@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.
                  >>
                  >
                  >
                  >

                  Comment

                  • Peter

                    #10
                    Re: Windows Service config file

                    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]" <stcheng@online .microsoft.comw rote in message
                    news:EKyhrUPpIH A.4284@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:
                    msdnmg@microsof t.com.
                    >
                    =============== =============== =============== =====
                    Get notification to my posts through email? Please refer to
                    Gain technical skills through documentation and training, earn certifications and connect with the community

                    ications.
                    >
                    =============== =============== =============== =====
                    This posting is provided "AS IS" with no warranties, and confers no
                    rights.
                    >
                    --------------------
                    >>From: "Peter" <czupet@nospam. nospam>
                    >>References: <OoiI1lIpIHA.21 88@TK2MSFTNGP04 .phx.gbl>
                    <003eda0c-26fb-48f9-91c5-24dfc359d2a3@x4 1g2000hsb.googl egroups.com>
                    <#0h#1pLpIHA.47 60@TK2MSFTNGP06 .phx.gbl>
                    <OyjZyRMpIHA.67 2@TK2MSFTNGP02. phx.gbl>
                    <O75p$DNpIHA.46 72@TK2MSFTNGP05 .phx.gbl>
                    <uhbX6TNpIHA.20 68@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]" <willy.denoyett e@telenet.bewro te in message
                    >>news:uhbX6TNp IHA.2068@TK2MSF TNGP05.phx.gbl. ..
                    >>"Peter" <czupet@nospam. nospamwrote in message
                    >>news:O75p$DNp IHA.4672@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.
                    >>>
                    >>
                    >>
                    >>
                    >

                    Comment

                    • Willy Denoyette [MVP]

                      #11
                      Re: Windows Service config file

                      "Peter" <czupet@nospam. nospamwrote in message
                      news:%23ZnJT5Pp IHA.1240@TK2MSF TNGP02.phx.gbl. ..
                      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]" <stcheng@online .microsoft.comw rote in message
                      news:EKyhrUPpIH A.4284@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:
                      >>
                      >RemotingConfig uration.CustomE rrorsMode = 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.runtim e.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.
                      >>
                      >>
                      >RemotingConfig uration.Configu re("SimpleRemot ingSln.ServerAp p.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:
                      >msdnmg@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" <czupet@nospam. nospam>
                      >>>References : <OoiI1lIpIHA.21 88@TK2MSFTNGP04 .phx.gbl>
                      ><003eda0c-26fb-48f9-91c5-24dfc359d2a3@x4 1g2000hsb.googl egroups.com>
                      ><#0h#1pLpIHA.4 760@TK2MSFTNGP0 6.phx.gbl>
                      ><OyjZyRMpIHA.6 72@TK2MSFTNGP02 .phx.gbl>
                      ><O75p$DNpIHA.4 672@TK2MSFTNGP0 5.phx.gbl>
                      ><uhbX6TNpIHA.2 068@TK2MSFTNGP0 5.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
                      >>>customErro rs 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 =
                      >>CustomErrorsM odes.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]" <willy.denoyett e@telenet.bewro te in message
                      >>>news:uhbX6TN pIHA.2068@TK2MS FTNGP05.phx.gbl ...
                      >>>"Peter" <czupet@nospam. nospamwrote in message
                      >>>news:O75p$DN pIHA.4672@TK2MS FTNGP05.phx.gbl ...
                      >>>>>I am using a Windows service with remoting
                      >>>>>
                      >>>>and I have tried both app.config file - where app =
                      >>>>application name.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.
                      >>>>
                      >>>
                      >>>
                      >>>
                      >>
                      >
                      >


                      What is the value returned by CustomErrorsEna bled when called after the
                      after setting the CustomErrorsMod e to Off?

                      ....
                      RemotingConfigu ration.CustomEr rorsMode = CustomErrorsMod es.Off;
                      bool customErrors = RemotingConfigu ration.CustomEr rorsEnabled(fal se);
                      // customErrors should be 'false', remote callers should get full exception
                      info including stack trace.....
                      ....

                      Willy.

                      Comment

                      • Peter

                        #12
                        Re: Windows Service config file


                        "Willy Denoyette [MVP]" <willy.denoyett e@telenet.bewro te in message
                        news:%23MlHknRp IHA.3456@TK2MSF TNGP05.phx.gbl. ..
                        "Peter" <czupet@nospam. nospamwrote in message
                        news:%23ZnJT5Pp IHA.1240@TK2MSF TNGP02.phx.gbl. ..
                        >RemotingConfig uration.CustomE rrorsMode = CustomErrorsMod es.Off;
                        >or
                        >RemotingConfig uration.Configu re("ReportsServ er.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.
                        >>
                        >RemotingConfig uration.CustomE rrorsMode = CustomErrorsMod es.Off;
                        >or
                        >RemotingConfig uration.Configu re("ReportsServ er.exe.config") ;
                        >>
                        >>
                        >"Steven Cheng [MSFT]" <stcheng@online .microsoft.comw rote in message
                        >news:EKyhrUPpI HA.4284@TK2MSFT NGHUB02.phx.gbl ...
                        >>Hi Peter,
                        >>>
                        >>Based on the code snippet you provided, you have used the following
                        >>code
                        >>to set the CustomErrorMode on server:
                        >>>
                        >>RemotingConfi guration.Custom ErrorsMode = 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.runti me.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.
                        >>>
                        >>>
                        >>RemotingConfi guration.Config ure("SimpleRemo tingSln.ServerA pp.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:
                        >>msdnmg@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" <czupet@nospam. nospam>
                        >>>>Reference s: <OoiI1lIpIHA.21 88@TK2MSFTNGP04 .phx.gbl>
                        >><003eda0c-26fb-48f9-91c5-24dfc359d2a3@x4 1g2000hsb.googl egroups.com>
                        >><#0h#1pLpIHA. 4760@TK2MSFTNGP 06.phx.gbl>
                        >><OyjZyRMpIHA. 672@TK2MSFTNGP0 2.phx.gbl>
                        >><O75p$DNpIHA. 4672@TK2MSFTNGP 05.phx.gbl>
                        >><uhbX6TNpIHA. 2068@TK2MSFTNGP 05.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 =
                        >>>CustomErrors Modes.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]" <willy.denoyett e@telenet.bewro te in message
                        >>>>news:uhbX6T NpIHA.2068@TK2M SFTNGP05.phx.gb l...
                        >>>>"Peter" <czupet@nospam. nospamwrote in message
                        >>>>news:O75p$D NpIHA.4672@TK2M SFTNGP05.phx.gb l...
                        >>>>>>I am using a Windows service with remoting
                        >>>>>>
                        >>>>>and I have tried both app.config file - where app =
                        >>>>>applicatio nname.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.
                        >>>>>
                        >>>>
                        >>>>
                        >>>>
                        >>>
                        >>
                        >>
                        >
                        >
                        >
                        What is the value returned by CustomErrorsEna bled when called after the
                        after setting the CustomErrorsMod e to Off?
                        >
                        ...
                        RemotingConfigu ration.CustomEr rorsMode = CustomErrorsMod es.Off;
                        bool customErrors = RemotingConfigu ration.CustomEr rorsEnabled(fal se);
                        // 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 :

                        RemotingConfigu ration.CustomEr rorsMode = CustomErrorsMod es.Off;
                        bool customErrors = RemotingConfigu ration.CustomEr rorsEnabled(fal se);



                        Comment

                        • Willy Denoyette [MVP]

                          #13
                          Re: Windows Service config file

                          "Peter" <czupet@nospam. nospamwrote in message
                          news:e0Qxm1TpIH A.3568@TK2MSFTN GP04.phx.gbl...
                          >
                          "Willy Denoyette [MVP]" <willy.denoyett e@telenet.bewro te in message
                          news:%23MlHknRp IHA.3456@TK2MSF TNGP05.phx.gbl. ..
                          >"Peter" <czupet@nospam. nospamwrote in message
                          >news:%23ZnJT5P pIHA.1240@TK2MS FTNGP02.phx.gbl ...
                          >>RemotingConfi guration.Custom ErrorsMode = CustomErrorsMod es.Off;
                          >>or
                          >>RemotingConfi guration.Config ure("ReportsSer ver.exe.config" );
                          >>>
                          >>does not make any difference.
                          >>the client still is getting
                          >>"Server encountered an internal error. For more information, turn off
                          >>customError s 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.
                          >>>
                          >>RemotingConfi guration.Custom ErrorsMode = CustomErrorsMod es.Off;
                          >>or
                          >>RemotingConfi guration.Config ure("ReportsSer ver.exe.config" );
                          >>>
                          >>>
                          >>"Steven Cheng [MSFT]" <stcheng@online .microsoft.comw rote in message
                          >>news:EKyhrUPp IHA.4284@TK2MSF TNGHUB02.phx.gb l...
                          >>>Hi Peter,
                          >>>>
                          >>>Based on the code snippet you provided, you have used the following
                          >>>code
                          >>>to set the CustomErrorMode on server:
                          >>>>
                          >>>RemotingConf iguration.Custo mErrorsMode = 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.runt ime.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.
                          >>>>
                          >>>>
                          >>>RemotingConf iguration.Confi gure("SimpleRem otingSln.Server App.exe.config" );
                          >>>........
                          >>>========== ==
                          >>>>
                          >>>Sincerely,
                          >>>>
                          >>>Steven Cheng
                          >>>>
                          >>>Microsoft MSDN Online Support Lead
                          >>>>
                          >>>>
                          >>>Delighting our customers is our #1 priority. We welcome your comments
                          >>>and
                          >>>suggestion s 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:
                          >>>msdnmg@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" <czupet@nospam. nospam>
                          >>>>>References : <OoiI1lIpIHA.21 88@TK2MSFTNGP04 .phx.gbl>
                          >>><003eda0c-26fb-48f9-91c5-24dfc359d2a3@x4 1g2000hsb.googl egroups.com>
                          >>><#0h#1pLpIHA .4760@TK2MSFTNG P06.phx.gbl>
                          >>><OyjZyRMpIHA .672@TK2MSFTNGP 02.phx.gbl>
                          >>><O75p$DNpIHA .4672@TK2MSFTNG P05.phx.gbl>
                          >>><uhbX6TNpIHA .2068@TK2MSFTNG P05.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
                          >>>>>customErro rs in the server's .config file."
                          >>>>>
                          >>>>>Here's the conde on the Server side.
                          >>>>>
                          >>>>>namespac e 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 =
                          >>>>CustomError sModes.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]" <willy.denoyett e@telenet.bewro te in message
                          >>>>>news:uhbX6 TNpIHA.2068@TK2 MSFTNGP05.phx.g bl...
                          >>>>>"Peter" <czupet@nospam. nospamwrote in message
                          >>>>>news:O75p$ DNpIHA.4672@TK2 MSFTNGP05.phx.g bl...
                          >>>>>>>I am using a Windows service with remoting
                          >>>>>>>
                          >>>>>>and I have tried both app.config file - where app =
                          >>>>>>applicati onname.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.
                          >>>>>>
                          >>>>>
                          >>>>>
                          >>>>>
                          >>>>
                          >>>
                          >>>
                          >>
                          >>
                          >>
                          >What is the value returned by CustomErrorsEna bled when called after the
                          >after setting the CustomErrorsMod e to Off?
                          >>
                          >...
                          >RemotingConfig uration.CustomE rrorsMode = CustomErrorsMod es.Off;
                          >bool customErrors = RemotingConfigu ration.CustomEr rorsEnabled(fal se);
                          >// 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 :
                          >
                          RemotingConfigu ration.CustomEr rorsMode = CustomErrorsMod es.Off;
                          bool customErrors = RemotingConfigu ration.CustomEr rorsEnabled(fal se);
                          >
                          >
                          >


                          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.

                          Comment

                          • Peter

                            #14
                            Re: Windows Service config file


                            "Willy Denoyette [MVP]" <willy.denoyett e@telenet.bewro te in message
                            news:uA$8RXVpIH A.4292@TK2MSFTN GP04.phx.gbl...
                            "Peter" <czupet@nospam. nospamwrote in message
                            news:e0Qxm1TpIH A.3568@TK2MSFTN GP04.phx.gbl...
                            >>
                            >"Willy Denoyette [MVP]" <willy.denoyett e@telenet.bewro te in message
                            >news:%23MlHknR pIHA.3456@TK2MS FTNGP05.phx.gbl ...
                            >>"Peter" <czupet@nospam. nospamwrote in message
                            >>news:%23ZnJT5 PpIHA.1240@TK2M SFTNGP02.phx.gb l...
                            >>>RemotingConf iguration.Custo mErrorsMode = CustomErrorsMod es.Off;
                            >>>or
                            >>>RemotingConf iguration.Confi gure("ReportsSe rver.exe.config ");
                            >>>>
                            >>>does not make any difference.
                            >>>the client still is getting
                            >>>"Server encountered an internal error. For more information, turn off
                            >>>customErro rs 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.
                            >>>>
                            >>>RemotingConf iguration.Custo mErrorsMode = CustomErrorsMod es.Off;
                            >>>or
                            >>>RemotingConf iguration.Confi gure("ReportsSe rver.exe.config ");
                            >>>>
                            >>>>
                            >>>"Steven Cheng [MSFT]" <stcheng@online .microsoft.comw rote in message
                            >>>news:EKyhrUP pIHA.4284@TK2MS FTNGHUB02.phx.g bl...
                            >>>>Hi Peter,
                            >>>>>
                            >>>>Based on the code snippet you provided, you have used the following
                            >>>>code
                            >>>>to set the CustomErrorMode on server:
                            >>>>>
                            >>>>RemotingCon figuration.Cust omErrorsMode = 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.run time.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.
                            >>>>>
                            >>>>>
                            >>>>RemotingCon figuration.Conf igure("SimpleRe motingSln.Serve rApp.exe.config ");
                            >>>>........
                            >>>>=========== =
                            >>>>>
                            >>>>Sincerely ,
                            >>>>>
                            >>>>Steven Cheng
                            >>>>>
                            >>>>Microsoft MSDN Online Support Lead
                            >>>>>
                            >>>>>
                            >>>>Delightin g our customers is our #1 priority. We welcome your comments
                            >>>>and
                            >>>>suggestio ns 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:
                            >>>>msdnmg@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" <czupet@nospam. nospam>
                            >>>>>>Reference s: <OoiI1lIpIHA.21 88@TK2MSFTNGP04 .phx.gbl>
                            >>>><003eda0c-26fb-48f9-91c5-24dfc359d2a3@x4 1g2000hsb.googl egroups.com>
                            >>>><#0h#1pLpIH A.4760@TK2MSFTN GP06.phx.gbl>
                            >>>><OyjZyRMpIH A.672@TK2MSFTNG P02.phx.gbl>
                            >>>><O75p$DNpIH A.4672@TK2MSFTN GP05.phx.gbl>
                            >>>><uhbX6TNpIH A.2068@TK2MSFTN GP05.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
                            >>>>>>customErr ors in the server's .config file."
                            >>>>>>
                            >>>>>>Here's the conde on the Server side.
                            >>>>>>
                            >>>>>>namespa ce 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 =
                            >>>>>CustomErro rsModes.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]" <willy.denoyett e@telenet.bewro te in message
                            >>>>>>news:uhbX 6TNpIHA.2068@TK 2MSFTNGP05.phx. gbl...
                            >>>>>>"Peter" <czupet@nospam. nospamwrote in message
                            >>>>>>news:O75p $DNpIHA.4672@TK 2MSFTNGP05.phx. gbl...
                            >>>>>>>>I am using a Windows service with remoting
                            >>>>>>>>
                            >>>>>>>and I have tried both app.config file - where app =
                            >>>>>>>applicat ionname.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.
                            >>>>>>>
                            >>>>>>
                            >>>>>>
                            >>>>>>
                            >>>>>
                            >>>>
                            >>>>
                            >>>
                            >>>
                            >>>
                            >>What is the value returned by CustomErrorsEna bled when called after the
                            >>after setting the CustomErrorsMod e to Off?
                            >>>
                            >>...
                            >>RemotingConfi guration.Custom ErrorsMode = CustomErrorsMod es.Off;
                            >>bool customErrors = RemotingConfigu ration.CustomEr rorsEnabled(fal se);
                            >>// 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 :
                            >>
                            >RemotingConfig uration.CustomE rrorsMode = CustomErrorsMod es.Off;
                            >bool customErrors = RemotingConfigu ration.CustomEr rorsEnabled(fal se);
                            >>
                            >>
                            >>
                            >
                            >
                            >
                            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 =
                            RemotingConfigu ration.CustomEr rorsEnabled(fal se);
                            on the server side did the trick.


                            Comment

                            • Steven Cheng [MSFT]

                              #15
                              Re: Windows Service config file

                              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:
                              msdnmg@microsof t.com.

                              =============== =============== =============== =====
                              Get notification to my posts through email? Please refer to
                              Gain technical skills through documentation and training, earn certifications and connect with the community

                              ications.

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

                              --------------------
                              >From: "Peter" <czupet@nospam. nospam>
                              >References: <OoiI1lIpIHA.21 88@TK2MSFTNGP04 .phx.gbl>
                              <003eda0c-26fb-48f9-91c5-24dfc359d2a3@x4 1g2000hsb.googl egroups.com>
                              <#0h#<e0Qxm1TpI HA.3568@TK2MSFT NGP04.phx.gbl>
                              <uA$8RXVpIHA.42 92@TK2MSFTNGP04 .phx.gbl>
                              >Subject: Re: Windows Service config file
                              >Date: Wed, 23 Apr 2008 14:53:36 -0500
                              >
                              >
                              >"Willy Denoyette [MVP]" <willy.denoyett e@telenet.bewro te in message
                              >news:uA$8RXVpI HA.4292@TK2MSFT NGP04.phx.gbl.. .
                              >"Peter" <czupet@nospam. nospamwrote in message
                              >news:e0Qxm1TpI HA.3568@TK2MSFT NGP04.phx.gbl.. .
                              >>>
                              >>"Willy Denoyette [MVP]" <willy.denoyett e@telenet.bewro te in message
                              >>news:%23MlHkn RpIHA.3456@TK2M SFTNGP05.phx.gb l...
                              >>>"Peter" <czupet@nospam. nospamwrote in message
                              >>>news:%23ZnJT 5PpIHA.1240@TK2 MSFTNGP02.phx.g bl...
                              >>>>RemotingCon figuration.Cust omErrorsMode = CustomErrorsMod es.Off;
                              >>>>or
                              >>>>RemotingCon figuration.Conf igure("ReportsS erver.exe.confi g");
                              >>>>>
                              >>>>does not make any difference.
                              >>>>the client still is getting
                              >>>>"Server encountered an internal error. For more information, turn off
                              >>>>customError s in the server's .config file."
                              >>>>>
                              >>>>>
                              >>>>I have tried to compile in Debug and Release and it did not make any
                              >>>>differenc e.
                              >>>>>
                              >>>>I know for a fact that the lines below get executed because I set the
                              >>>>port number in the same method.
                              >>>>>
                              >>>>RemotingCon figuration.Cust omErrorsMode = CustomErrorsMod es.Off;
                              >>>>or
                              >>>>RemotingCon figuration.Conf igure("ReportsS erver.exe.confi g");
                              >>>>>
                              >>>>>
                              >>>>"Steven Cheng [MSFT]" <stcheng@online .microsoft.comw rote in message
                              >>>>news:EKyhrU PpIHA.4284@TK2M SFTNGHUB02.phx. gbl...
                              >>>>>Hi Peter,
                              >>>>>>
                              >>>>>Based on the code snippet you provided, you have used the following
                              >>>>>code
                              >>>>>to set the CustomErrorMode on server:
                              >>>>>>
                              >>>>>RemotingCo nfiguration.Cus tomErrorsMode = 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.ru ntime.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");
                              >>>>>........
                              >>>>>========== ==
                              >>>>>>
                              >>>>>S

                              Comment

                              Working...