SOAP-UI Http 状态:405 - 不允许传入请求的 HTTP 方法 'GET'...

SOAP-UI Http Status: 405 - The HTTP method 'GET' of the incoming request... is not allowed

我正在执行从 SOAP-UI 到 IIS C# REST/JSON Web 服务的 POST。我让它工作,然后将我的 web.config 更改为需要 SSL,然后这个问题开始了。 还将 IIS webservice 更改为需要 SSL 而不是接受。

现在我在 SOAP-UI 的 RAW 视图中收到错误:

HTTP/1.1 405 Method Not Allowed
Allow: POST
Content-Length: 1565
Content-Type: text/html; charset=UTF-8
Server: Microsoft-IIS/7.5

来自跟踪侦听器:

    <ExceptionString>System.InvalidOperationException: The HTTP method 'GET' of the incoming request (with URI 'https://mysite/MyApp/SQRTREST.svc/placeOrderSQRT/') is not allowed.</ExceptionString>
<StackTrace>   at System.Runtime.Diagnostics.EtwDiagnosticTrace.WriteExceptionToTraceString(XmlTextWriter xml, Exception exception, Int32 remainingLength, Int32 remainingAllowedRecursionDepth)
   at System.Runtime.Diagnostics.EtwDiagnosticTrace.ExceptionToTraceString(Exception exception, Int32 maxTraceStringLength)
   at System.Runtime.Diagnostics.EtwDiagnosticTrace.GetSerializedPayload(Object source, TraceRecord traceRecord, Exception exception, Boolean getServiceReference)
   at System.Runtime.TraceCore.HandledExceptionWarning(EtwDiagnosticTrace trace, String param0, Exception exception)
   at System.ServiceModel.Dispatcher.HttpUnhandledOperationInvoker.Invoke(Object instance, Object[] inputs, Object[]&amp;amp; outputs)
   at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&amp;amp; rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc&amp;amp; rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc&amp;amp; rpc)
   at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)
   at System.ServiceModel.Dispatcher.ChannelHandler.DispatchAndReleasePump(RequestContext request, Boolean cleanThread, OperationContext currentOperationContext)
   at System.ServiceModel.Dispatcher.ChannelHandler.HandleRequest(RequestContext request, OperationContext currentOperationContext)
   at System.ServiceModel.Dispatcher.ChannelHandler.AsyncMessagePump(IAsyncResult result)

那么,如果 SOAP-UI 正在执行 POST,为什么错误与 HTTP "GET" 方法有关?

生产中的 SOAP-UI 也发生了这种情况,但外部客户端似乎仍然能够使用他们正在使用的任何软件调用网络服务。

我在 StackOveflow 上看到其他关于 405 的 post,但没有找到 SOAP-UI post。

在 post 上述内容后的第二天更新:

1) 我使用 Debug/Trace 进行设置 - 当 运行 SOAP-UI 时,跟踪从未进入方法

2) 我设置了一个执行 Post 的 C# 客户端程序,它确实进入了方法并且我能够使用 Debug/Trace(它以我遇到的另一个问题结束解开)。

更新 2:一些研究让我认为这可能与 HTTP Headers 被加密这一事实有关。 SOAP-Ui 论坛中有人提到缺少 HTTP Header;但不确定这会将我引向何方...

这引导我找到解决方案:

https://forums.iis.net/t/1152122.aspx?HTTP+1+1+405+Method+Not+Allowed+Allow+OPTIONS+TRACE+GET+HEAD

我只是在我的方法名称上添加了一个尾部斜杠。 我将端点设置为 xxx.svc。 然后我将 Resource 设置为一个值,例如 /Resource1。 通过将其更改为 /Resource1/ 它起作用了。

上面的link表明它试图读取目录或其他东西。