C # Remoting - Cómo desactivar customErrors


Recibo el siguiente error cuando intento conectarme a mi aplicación de servidor usando la comunicación remota:

Un problema parece haber ocurrido mientras se conecta al servidor remoto:
El servidor encontró un error interno. Para obtener más información, desactive customErrors en el servidor .archivo de configuración.

Este es el código en mi aplicación de servidor:

TcpChannel tcpChannel = new TcpChannel(999);
MyRemoteObject remObj = new MyRemoteObject (this);
RemotingServices.Marshal(remObj, "MyUri");
ChannelServices.RegisterChannel(tcpChannel);

Parece funcionar la primera vez, pero a menos que se reinicie la aplicación de servidor, se produce el error.

Me gustaría supongo que algo no se está limpiando correctamente, pero no estoy seguro de lo que como el CustomError está todavía en.

Cualquier idea por donde empiezo. Gracias.

[EDITAR] - Gracias a Gulzar, modificé mi código anterior a lo siguiente y ahora se muestran los errores:

RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;
TcpChannel tcpChannel = new TcpChannel(999);
MyRemoteObject remObj = new MyRemoteObject (this);
RemotingServices.Marshal(remObj, "MyUri");
ChannelServices.RegisterChannel(tcpChannel);
Author: Drew Noakes, 2008-10-16

3 answers

Para. Net 1.0 / 1.1 , necesita un archivo de configuración para el servidor remoto

Si no tiene un archivo <ServerEXE>.config, cree uno y tenga esto en él:

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

Para.Net 2.0, puede usar RemotingConfiguration.CustomErrorsMode propiedad

 37
Author: Gulzar Nazim,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-03-17 15:11:08

En el archivo del servidor, use:

RemotingConfiguration.CustomErrorsEnabled(bool);
 5
Author: sometimes,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-07-27 11:40:57

Para desactivar customErrors, abra el web.config file en el servidor. Si hay una etiqueta customErrors, cámbiala. Si no hay uno, añádelo.

Debe ser <customErrors mode="Off"/> para este propósito.

Si de hecho está utilizando una página de error personalizada, querrá cambiar esta configuración una vez que haya encontrado su problema.

 0
Author: DOK,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-07-27 11:41:16