为什么在使用swashbuckle时出错?

时间:2019-04-23 05:40:30

标签: c# asp.net-mvc-4 swagger asp.net-apicontroller api-versioning

我已经在我的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版本控制。 请提出解决此问题的方法。

0 个答案:

没有答案