Login Login
MORE

WIDGETS

Widgets

Wanted articles
Who is online?
Article tools

CSharp:Errori e soluzioni

From Aino Wiki

Jump to: navigation, search

Errori RunTime

TypeInitializationException

Dettagli dell'errore:

<ExceptionMessage>
The type initializer for '''Classe dove si verifica l'errore''' threw an exception.
</ExceptionMessage>
<ExceptionType>System.TypeInitializationException</ExceptionType>
<ExceptionMessage>
Object reference not set to an instance of an object.
</ExceptionMessage>
<ExceptionType>System.NullReferenceException</ExceptionType>



SOLUZIONE
Verificare se un oggetto usato ha proprietà (es. accessi al Web.config) che accedono\usano oggetti non inizializzati. Il problema si verifica runtime su una DLL\progetto in cui ci sono oggetti non inizializzati con la new.

Protocolli

TCP UDP

Condividere la stessa porta

Qui StackOverflow si dice che c’è una modalità di aprire i socket in modo che condividano una porta:

You will have to bind the socket in both processes with the SO_REUSEPORT option. 
If you don't specify this option in the first process, binding in the second will fail. 
Likewise, if you specify this option in the first but not the second, binding in the second 
will fail. 
This option effectively specifies both a request ("I want to bind to this port even if 
it's already bound by another process") and a permission ("other processes may bind to this 
port too")

Non so come questa opzione SO_REUSEPORT sia stata implementata in .Net ma è da usare.


C#

Author