在容器中运行时,AspNetCore 2.1 Web应用程序无法通过外部SOAP服务进行身份验证

时间:2018-08-03 08:05:01

标签: asp.net-core-2.1 .net-core-2.1

我正在尝试将Asp.Net-Core Web应用程序从1.1迁移到2.1。除了消耗外部肥皂服务的模块以外,大多数部件都按预期工作。服务参考(连接的服务)中定义了要连接到该服务的客户端,并且该客户端使用Digest身份验证方案。

我注意到的是,在1.1中,当客户端调用操作时,向外部端点发出了一系列请求(2 HEAD 2 POST),客户端将获得标头,添加Authorization标头,然后继续操作。开机自检 在2.1中,缺少Connection:keep-alive标头,因此导致缺少Authorization标头,并且请求被拒绝。

我了解了有关SocketsHttpHandler的更改,并使用了:

AppContext.SetSwitch("System.Net.Http.UseSocketsHttpHandler", false);

虽然这似乎可以解决从VS本地运行时的问题,但似乎在UNIX环境中运行,最终在docker容器中运行,该问题再次出现。

我尝试按照aspnetcore 2.1 Docs中的建议手动部署libcurl,还尝试了使用Kestrel和Libuv进行不同的配置,但最终结果是相同的。在2.0中也尝试过,它具有相同的行为。

尝试在Unix env或docker中运行时引发的异常如下:

An error ocurred while trying to fetch foo with id: 10720 and message : The HTTP request is unauthorized with client authentication scheme 'Digest'. The authentication header received from the server was 'Digest realm="", nonce="MjAxOC0wOC0wMyAxMTo1NzowOA", opaque="0000000000000000", stale=false, algorithm=MD5, qop="auth"'.
Unhandled Exception: System.ServiceModel.Security.MessageSecurityException: The HTTP request is unauthorized with client authentication scheme 'Digest'. The authentication header received from the server was 'Digest realm="", nonce="MjAxOC0wOC0wMyAxMTo1NzowOA", opaque="0000000000000000", stale=false, algorithm=MD5, qop="auth"'. at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result) at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result) at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result) at System.ServiceModel.Channels.ServiceChannelProxy.TaskCreator.<>c__DisplayClass1_0.<CreateGenericTask>b__0(IAsyncResult asyncResult) --- End of stack trace from previous location where exception was thrown --- ...

我还尝试将使用的System.ServiceModel。*软件包的版本从4.3。*更改为4.4.4和4.5.3,但没有成功。

目前,我已经没有足够的想法和地方来寻找更多的信息。因此,任何建议将不胜感激。

0 个答案:

没有答案