0

我在我的 API 项目中安装了“swashbuckle”,但是当我尝试打开 swagger UI 页面时,出现以下错误

<Error>
<Message>An error has occurred.</Message>
<ExceptionMessage>Unable to read the entity body. The request stream has already been read in 'Bufferless' mode.</ExceptionMessage><ExceptionType>System.InvalidOperationException</ExceptionType><StackTrace>   at System.Web.Http.WebHost.HttpControllerHandler.<>c__DisplayClass18_0.<GetStreamContent>b__0()
   at System.Web.Http.WebHost.HttpControllerHandler.LazyStreamContent.get_StreamContent()
   at System.Web.Http.WebHost.HttpControllerHandler.LazyStreamContent.SerializeToStreamAsync(Stream stream, TransportContext context)
   at System.Net.Http.HttpContent.LoadIntoBufferAsync(Int64 maxBufferSize)
   at System.Net.Http.HttpContent.ReadAsStringAsync()
   at KeyNestApi.WebApiConfig.LogRequestAndResponseHandler.<SendAsync>d__1.MoveNext() in E:\Projects\KeyNest\ApiCode\Development_NewApp\KeyNestApi\App_Start\WebApiConfig.cs:line 41
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.HttpServer.<SendAsync>d__24.MoveNext()</StackTrace></Error>

我的 Swashbuckle 版本是 5.6.0,.Net 框架是 4.6.1。我也在使用 api 版本控制。请建议如何解决此问题。

4

0 回答 0