服务器无法发送响应

时间:2018-10-29 05:21:03

标签: c# .net asp.net-core postman

美好的一天。 我知道这个问题已经问过了。但是我真的不能使这个东西正常工作。

我正在使用Visual Studio 2017

我正在关注有关如何使用Asp.net核心和angular来构建应用的教程

我的问题是我无法使用邮递员向该站点发送请求。

我已从下面的链接中阅读了答案,但所有答案均无效

"Could not get any response" response when using postman with subdomain

这是我的launchSettings.json

"DatingApp.API": {
      "commandName": "Project",
      "launchBrowser": false,
      "launchUrl": "api/values",
      "applicationUrl": "http://localhost:5000",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }

当我运行API

enter image description here

https://localhost:5000/api/values)并使用邮递员发送请求。

这是我的错误

enter image description here

而且我在Visual Studio输出窗口中也收到错误

Microsoft.AspNetCore.Server.Kestrel:Information: Connection id "0HLHTBLQGR6JP" bad request data: "Invalid request line: '\x16\x03\x01\x01\x01\x01\x00\x00\xFD\x03\x03e*\xD2K\x9C\xA5\x99\xAA\xB4.\x0C+\x8F\xE2\xFF\xB6$\x05\xDA\xA4\xD5a\xBD\x1Fx\xBB\x18\xF6\xE5\xD5fO\x00\x00n\xC0/\xC0+\xC00\xC0,\x00\x9E\xC0'\x00g\xC0(\x00k\xC0$\xC0\x14\xC0\x0A'"

Microsoft.AspNetCore.Server.Kestrel.Core.BadHttpRequestException: Invalid request line: '\x16\x03\x01\x01\x01\x01\x00\x00\xFD\x03\x03e*\xD2K\x9C\xA5\x99\xAA\xB4.\x0C+\x8F\xE2\xFF\xB6$\x05\xDA\xA4\xD5a\xBD\x1Fx\xBB\x18\xF6\xE5\xD5fO\x00\x00n\xC0/\xC0+\xC00\xC0,\x00\x9E\xC0'\x00g\xC0(\x00k\xC0$\xC0\x14\xC0\x0A'
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpParser`1.RejectRequestLine(Byte* requestLine, Int32 length)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpParser`1.GetUnknownMethod(Byte* data, Int32 length, Int32& methodLength)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpParser`1.ParseRequestLine(TRequestHandler handler, Byte* data, Int32 length)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpParser`1.ParseRequestLine(TRequestHandler handler, ReadOnlySequence`1& buffer, SequencePosition& consumed, SequencePosition& examined)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpParser`1.Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.IHttpParser<TRequestHandler>.ParseRequestLine(TRequestHandler handler, ReadOnlySequence`1& buffer, SequencePosition& consumed, SequencePosition& examined)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Http1Connection.TakeStartLine(ReadOnlySequence`1 buffer, SequencePosition& consumed, SequencePosition& examined)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Http1Connection.ParseRequest(ReadOnlySequence`1 buffer, SequencePosition& consumed, SequencePosition& examined)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Http1Connection.TryParseRequest(ReadResult result, Boolean& endConnection)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequestsAsync[TContext](IHttpApplication`1 application)

但是当我使用IIS Express运行程序时。它有效,我可以使用邮递员发送请求。

我的代码怎么了?

0 个答案:

没有答案