CoreWCF / CoreWCF/samples

Logging DI sample does not work in a template without Minimal APIs

Aperta
#18 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
C#
Stelle
50
Fork
22
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

**Which sample is the bug for**

DI logging in a template that was made without Minimal API use

Please see an example here
https://github.com/mccreah/samples

**Describe the bug**

No matter what I do and how I register various business services I will always get the following exception on service calls:

```



a:InternalServiceFault
The service implementation object was not initialized or is not available.




The service implementation object was not initialized or is not available.
at CoreWCF.Dispatcher.SyncMethodInvoker.InvokeAsync(Object instance, Object[] inputs)
at CoreWCF.Dispatcher.DispatchOperationRuntime.<>c__DisplayClass68_0.<<InvokeAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at CoreWCF.Dispatcher.DispatchOperationRuntime.InvokeAsync(MessageRpc rpc)
at CoreWCF.Dispatcher.DispatchOperationRuntime.InvokeAsync(MessageRpc rpc)
at CoreWCF.Dispatcher.ImmutableDispatchRuntime.ProcessMessageAsync(MessageRpc rpc)
at CoreWCF.Dispatcher.MessageRpc.ProcessAsync(Boolean isOperationContextSet)
System.InvalidOperationException



```

Exception details only:

```



The service implementation object was not initialized or is not available.
at CoreWCF.Dispatcher.SyncMethodInvoker.InvokeAsync(Object instance, Object[] inputs)
at CoreWCF.Dispatcher.DispatchOperationRuntime.<>c__DisplayClass68_0.<<InvokeAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at CoreWCF.Dispatcher.DispatchOperationRuntime.InvokeAsync(MessageRpc rpc)
at CoreWCF.Dispatcher.DispatchOperationRuntime.InvokeAsync(MessageRpc rpc)
at CoreWCF.Dispatcher.ImmutableDispatchRuntime.ProcessMessageAsync(MessageRpc rpc)
at CoreWCF.Dispatcher.MessageRpc.ProcessAsync(Boolean isOperationContextSet)
System.InvalidOperationException

```

**To Reproduce**
Steps to reproduce the behavior:

1. Clone my samples repo and run the other app LoggingSampleNoMinimalApis.
2. Make a SOAP request to the service.
3. Exception always occurs, service contructor is never hit when debugging.

**Expected behavior**
No exception, service constructor should be called. The way it works in the Minimal API example.

**Repo environment (please complete the following information):**
- Windows 10
- x64
- .NET 6
- VS 2022

**Additional context**

If this issue should've been opened in the main CoreWCF repo, feel free to move it there.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Clona il repository dei samples collegato ed esegui l'applicazione LoggingSampleNoMinimalApis, quindi confronta la relativa configurazione di hosting e del servizio con quella dell'esempio Minimal API. Riproduci la richiesta SOAP e traccia il motivo per cui l'implementazione del servizio non è disponibile; il lavoro è completato quando viene chiamato il costruttore del servizio e la richiesta termina senza l'eccezione riportata.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
csharp
Ambito
api, backend
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.