Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ builder.Services.AddMagicOnionJsonTranscodingSwagger();
builder.Services.AddSwaggerGen(options =>
{
// Reflect the XML documentation comments of the service definition in Swagger.
// To use this feature, you must enable the Generate XML Comments option in project options.
options.IncludeMagicOnionXmlComments(Path.Combine(AppContext.BaseDirectory, "JsonTranscodingSample.Shared.xml"));
});

Expand All @@ -50,5 +51,22 @@ app.MapGet("/", () => "Communication with gRPC endpoints must be made through a

app.Run();
```

![image](https://github.com/user-attachments/assets/a101cb00-c9ad-42b6-93d4-87c0d8d23773)



## 트러블슈팅

런타임에서, 아래와같은 Exception 발생시, `builder.Services.AddEndpointsApiExplorer();` 구문 추가가 도움이 될수있습니다.
```csharp
System.AggregateException: Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType: Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator Lifetime: Transient ImplementationType: Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator': No constructor for type 'Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator' can be instantiated using services from the service container and default values.)
```


참고
MagicOnion 에서 사용된 Swashbuckle.AspNetCore.Swagger 의 사용법이 기록된 MSDN 입니다.
https://learn.microsoft.com/ko-kr/aspnet/core/tutorials/getting-started-with-swashbuckle?view=aspnetcore-8.0&tabs=visual-studio

```csharp
builder.Services.AddEndpointsApiExplorer();
```