AspNetCore.Proxy 重用连接错误消息
我使用 AspNetCore.Proxy 向 SSRS(报告服务)应用程序提供请求
->代理(应用程序内部)-> SSRS
该应用程序可从外部网络访问。 SSRS 只能从内部网络 (HTTP) 访问。
当应用程序在 HTTP (80) 上发布时,不会发生任何问题或错误。 但是,当应用程序在 HTTPS (443) 上发布时,会发生重用连接错误。 SSRS 在 HTTP 上使用自己的内部门户网站 (80)
请求无法被代理。 由于无法重用连接,身份验证失败。
那么,如何解决这个错误呢?
应用程序代理配置:
app.UseProxies(proxies =>
{
var url = (string)null;
proxies.Map(
"ReportServer.aspx",
proxy => proxy.UseHttp((context, args) =>
{
url = $"{_reportSettings.SSRSReportServerBaseUrl}/ReportServer/Pages/ReportViewer.aspx" + context.Request.QueryString;
_logger.WriteWithCallerName(LogLevel.Debug, "Startup::Proxy", url);
return url;
},
builder => builder.WithHttpClientName(HTTP_CLIENT_NAME))
);
proxies.Map(
_reportSettings.SSRSProxyRouteBase,
proxy => proxy.UseHttp((context, args) =>
{
url = $"{_reportSettings.SSRSReportServerBaseUrl}/ReportServer/Pages/ReportViewer.aspx" + context.Request.QueryString;
_logger.WriteWithCallerName(LogLevel.Debug, "Startup::Proxy", url);
return url;
},
builder => builder.WithHttpClientName(HTTP_CLIENT_NAME))
);
proxies.Map(
_reportSettings.SSRSProxyRouteBase + "/{**rest}",
proxy => proxy.UseHttp((context, args) =>
{
url = $"{_reportSettings.SSRSReportServerBaseUrl}/ReportServer/" + args["rest"] + context.Request.QueryString;
_logger.WriteWithCallerName(LogLevel.Debug, "Startup::Proxy", url);
return url;
},
builder => builder.WithHttpClientName(HTTP_CLIENT_NAME))
);
});
来自设置的参数:
"SSRSReportServerBaseUrl": "http://172.16.1.40",
"SSRSProxyRouteBase": "ReportServer",
I use AspNetCore.Proxy to serve request to SSRS (reports service)
Application -> Proxy (inside application) -> SSRS
The application is accessible from an external network.
SSRS is accessible only from an internal network (HTTP)
When the application is published on HTTP (80) no issues or errors happen.
But, when the application is published on HTTPS (443) - a reuse connection error occurs.
SSRS uses its own internal web portal on HTTP (80)
Request could not be proxied.
Authentication failed because the connection could not be reused.
So, how to resolve this error?
Application proxy config:
app.UseProxies(proxies =>
{
var url = (string)null;
proxies.Map(
"ReportServer.aspx",
proxy => proxy.UseHttp((context, args) =>
{
url = quot;{_reportSettings.SSRSReportServerBaseUrl}/ReportServer/Pages/ReportViewer.aspx" + context.Request.QueryString;
_logger.WriteWithCallerName(LogLevel.Debug, "Startup::Proxy", url);
return url;
},
builder => builder.WithHttpClientName(HTTP_CLIENT_NAME))
);
proxies.Map(
_reportSettings.SSRSProxyRouteBase,
proxy => proxy.UseHttp((context, args) =>
{
url = quot;{_reportSettings.SSRSReportServerBaseUrl}/ReportServer/Pages/ReportViewer.aspx" + context.Request.QueryString;
_logger.WriteWithCallerName(LogLevel.Debug, "Startup::Proxy", url);
return url;
},
builder => builder.WithHttpClientName(HTTP_CLIENT_NAME))
);
proxies.Map(
_reportSettings.SSRSProxyRouteBase + "/{**rest}",
proxy => proxy.UseHttp((context, args) =>
{
url = quot;{_reportSettings.SSRSReportServerBaseUrl}/ReportServer/" + args["rest"] + context.Request.QueryString;
_logger.WriteWithCallerName(LogLevel.Debug, "Startup::Proxy", url);
return url;
},
builder => builder.WithHttpClientName(HTTP_CLIENT_NAME))
);
});
Parameters from settings:
"SSRSReportServerBaseUrl": "http://172.16.1.40",
"SSRSProxyRouteBase": "ReportServer",
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最后我有了可行的解决方案。
详细信息请参见 proxy lib github 页面
重用连接问题
Finally I had have works solution.
Details described at proxy lib github page
Reuse connection issue