【发布时间】:2019-06-04 23:53:27
【问题描述】:
我在 IIS 上托管我的 BOT Framework V4 BOT。 服务器配置如下
- Windows Server 2012 R2
- IIS 8.5
我还安装了 dotnet-hosting-2.2.1-win.exe,这是托管 BOT V4 所必需的。我已将应用程序池设置为无托管代码。 我已经设置了 Startup.cs 文件所在文件夹的路径。 另外请找到BOT生成的日志的附件。 尽管如此,它仍然无法正常工作,错误如下
HTTP 错误 403.14 - 禁止 Web 服务器配置为不列出此目录的内容。
Detailed Error Information:
Module DirectoryListingModule
Notification ExecuteRequestHandler
Handler StaticFile
Error Code 0x00000000
Requested URL https://myServer/ConfRoomBOT/
Physical Path ProjectPath
Logon Method Anonymous
Logon User Anonymous
Request Tracing Directory C:\inetpub\logs\FailedReqLogFiles
下面是web.config代码
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\ConfRoom.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</location>
<system.net>
<defaultProxy useDefaultCredentials="false">
<proxy usesystemdefault="False" proxyaddress="http://xx.xxx.xx.xxx:8080" bypassonlocal="True" />
</defaultProxy>
</system.net>
</configuration>
以下是BOT生成的日志
托管环境:生产内容根路径: E:\Project\DotNetCoreApps\ConfRoomPub\WithPII\publish 现在收听 on:http://127.0.0.1:41826 应用程序已启动。按 Ctrl+C 关闭 下。信息:Microsoft.AspNetCore.Hosting.Internal.WebHost[1] 请求开始 HTTP/1.1 GET http://example.com/ConfRoom/ info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1] 请求开始 HTTP/1.1 GET http://example.com/ConfRoom/ info: Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware[2] 发送文件。请求路径:'/default.htm'。物理路径:'E:\Project\DotNetCoreApps\ConfRoomPub\WithPII\publish\wwwroot\default.htm' 信息:Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware[6] 文件 /default.htm 未修改信息:Microsoft.AspNetCore.Hosting.Internal.WebHost[2] 请求在 184.4402 毫秒内完成 304 文本/html 信息:Microsoft.AspNetCore.Hosting.Internal.WebHost[2] 请求在 188.1919 毫秒内完成 200 文本/html 信息:Microsoft.AspNetCore.Hosting.Internal.WebHost[1] 请求开始 HTTP/1.1 POST http://example.com/ConfRoom/api/messages application/json; 字符集=utf-8 373 信息: Microsoft.AspNetCore.Hosting.Internal.WebHost[1] 请求开始 HTTP/1.1 POST http://example.com/ConfRoom/api/messages application/json; charset=utf-8 359 失败:Microsoft.AspNetCore.Server.Kestrel[13] 连接 ID“0HLJNNKCOIPS7”,请求 ID“0HLJNNKCOIPS7:00000002”:未处理的异常被抛出 应用。 System.InvalidOperationException:IDX20803:无法 从以下位置获取配置: 'https://login.botframework.com/v1/.well-known/openidconfiguration'。 ---> System.IO.IOException:IDX20804:无法从以下位置检索文档: 'https://login.botframework.com/v1/.well-known/openidconfiguration'。 ---> System.Net.Http.HttpRequestException:连接尝试失败,因为连接方在一段时间后没有正确响应 时间,或建立连接失败,因为连接的主机有 没有回应 ---> System.Net.Sockets.SocketException:连接尝试失败,因为连接方在一段时间后没有正确响应 时间,或建立连接失败,因为连接的主机有 未能回应 System.Net.Http.ConnectHelper.ConnectAsync(字符串主机,Int32 端口, CancellationToken cancelToken) --- 内部异常结束 堆栈跟踪 --- 在 System.Net.Http.ConnectHelper.ConnectAsync(字符串主机,Int32 端口, CancellationToken 取消令牌)在 System.Threading.Tasks.ValueTask
1.get_Result() at System.Net.Http.HttpConnectionPool.CreateConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken) at System.Threading.Tasks.ValueTask1.get_Result() 在 System.Net.Http.HttpConnectionPool.WaitForCreatedConnectionAsync(ValueTask1 creationTask) at System.Threading.Tasks.ValueTask1.get_Result()
在 System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancelToken)
在 System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage 请求,CancellationToken 取消令牌)在 System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts) at Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.GetDocumentAsync(String address, CancellationToken cancel) --- End of inner exception stack trace --- at Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.GetDocumentAsync(String address, CancellationToken cancel) at Microsoft.IdentityModel.Protocols.OpenIdConnect.OpenIdConnectConfigurationRetriever.GetAsync(String address, IDocumentRetriever retriever, CancellationToken cancel) at Microsoft.IdentityModel.Protocols.ConfigurationManager1.GetConfigurationAsync(CancellationToken 取消)---内部异常堆栈跟踪结束---在 Microsoft.IdentityModel.Protocols.ConfigurationManager1.GetConfigurationAsync(CancellationToken cancel) at Microsoft.IdentityModel.Protocols.ConfigurationManager1.GetConfigurationAsync() 在 Microsoft.Bot.Connector.Authentication.JwtTokenExtractor.ValidateTokenAsync(字符串 jwtToken, 字符串 channelId) 在 Microsoft.Bot.Connector.Authentication.JwtTokenExtractor.GetIdentityAsync(字符串 方案,字符串参数,字符串channelId)在 Microsoft.Bot.Connector.Authentication.JwtTokenExtractor.GetIdentityAsync(字符串 授权标头,字符串 channelId)在 Microsoft.Bot.Connector.Authentication.ChannelValidation.AuthenticateChannelToken(字符串 authHeader、ICredentialProvider 凭据、HttpClient httpClient、 字符串 channelId) 在 Microsoft.Bot.Connector.Authentication.ChannelValidation.AuthenticateChannelToken(字符串 authHeader、ICredentialProvider 凭据、字符串 serviceUrl、 HttpClient httpClient, String channelId) 在 Microsoft.Bot.Connector.Authentication.JwtTokenValidation.ValidateAuthHeader(字符串 authHeader、ICredentialProvider 凭据、IChannelProvider channelProvider,字符串 channelId,字符串 serviceUrl,HttpClient httpClient) 在 Microsoft.Bot.Connector.Authentication.JwtTokenValidation.AuthenticateRequest(IActivity 活动,字符串 authHeader,ICredentialProvider 凭据, IChannelProvider 提供程序,HttpClient httpClient) 在 Microsoft.Bot.Builder.BotFrameworkAdapter.ProcessActivityAsync(字符串 authHeader、Activity 活动、BotCallbackHandler 回调、 CancellationToken 取消令牌)在 Microsoft.Bot.Builder.Integration.AspNet.Core.Handlers.BotMessageHandler.ProcessMessageRequestAsync(HttpRequest 请求,IAdapterIntegration 适配器,BotCallbackHandler botCallbackHandler, CancellationToken cancelToken) 在 Microsoft.Bot.Builder.Integration.AspNet.Core.Handlers.BotMessageHandlerBase.HandleAsync(HttpContext httpContext) 在 Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.Invoke(HttpContext 上下文)在 Microsoft.AspNetCore.Server.IISIntegration.IISMiddleware.Invoke(HttpContext httpContext) 在 Microsoft.AspNetCore.Builder.Extensions.UsePathBaseMiddleware.Invoke(HttpContext 上下文)在 Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication1 application) fail: Microsoft.AspNetCore.Server.Kestrel[13] Connection id "0HLJNNKCOIPS6", Request id "0HLJNNKCOIPS6:00000002": An unhandled exception was thrown by the application. System.InvalidOperationException: IDX20803: Unable to obtain configuration from: 'https://login.botframework.com/v1/.well-known/openidconfiguration'.1.GetConfigurationAsync(CancellationToken 取消)在 Microsoft.IdentityModel.Protocols.ConfigurationManager
at Microsoft.IdentityModel.Protocols.ConfigurationManager1.GetConfigurationAsync() at Microsoft.Bot.Connector.Authentication.JwtTokenExtractor.ValidateTokenAsync(String jwtToken, String channelId) at Microsoft.Bot.Connector.Authentication.JwtTokenExtractor.GetIdentityAsync(String scheme, String parameter, String channelId) at Microsoft.Bot.Connector.Authentication.JwtTokenExtractor.GetIdentityAsync(String authorizationHeader, String channelId) at Microsoft.Bot.Connector.Authentication.ChannelValidation.AuthenticateChannelToken(String authHeader, ICredentialProvider credentials, HttpClient httpClient, String channelId) at Microsoft.Bot.Connector.Authentication.ChannelValidation.AuthenticateChannelToken(String authHeader, ICredentialProvider credentials, String serviceUrl, HttpClient httpClient, String channelId) at Microsoft.Bot.Connector.Authentication.JwtTokenValidation.ValidateAuthHeader(String authHeader, ICredentialProvider credentials, IChannelProvider channelProvider, String channelId, String serviceUrl, HttpClient httpClient) at Microsoft.Bot.Connector.Authentication.JwtTokenValidation.AuthenticateRequest(IActivity activity, String authHeader, ICredentialProvider credentials, IChannelProvider provider, HttpClient httpClient) at Microsoft.Bot.Builder.BotFrameworkAdapter.ProcessActivityAsync(String authHeader, Activity activity, BotCallbackHandler callback, CancellationToken cancellationToken) at Microsoft.Bot.Builder.Integration.AspNet.Core.Handlers.BotMessageHandler.ProcessMessageRequestAsync(HttpRequest request, IAdapterIntegration adapter, BotCallbackHandler botCallbackHandler, CancellationToken cancellationToken) at Microsoft.Bot.Builder.Integration.AspNet.Core.Handlers.BotMessageHandlerBase.HandleAsync(HttpContext httpContext) at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Server.IISIntegration.IISMiddleware.Invoke(HttpContext httpContext) at Microsoft.AspNetCore.Builder.Extensions.UsePathBaseMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication1 应用程序)信息:Microsoft.AspNetCore.Hosting.Internal.WebHost[2] 请求在 21679.9889ms 500 信息中完成:Microsoft.AspNetCore.Hosting.Internal.WebHost[2] 请求在 14958.2414 毫秒内完成 500 信息:Microsoft.AspNetCore.Hosting.Internal.WebHost[1] 请求开始 HTTP/1.1 POST http://127.0.0.1:41826/CONFROOM/iisintegration 0 信息: Microsoft.AspNetCore.Hosting.Internal.WebHost[2] 请求在 0.373 毫秒内完成 202 应用程序正在关闭...
请帮助。 谢谢。
【问题讨论】:
-
能否更新您的问题以包含您的 web.config 文件?
-
这是一个运行在 .NET core 2.0 上的 BOT Framework V4 应用程序,所以没有 web.config 文件,它有 appsettings.json 文件。
-
您确定它不起作用吗?默认情况下,您无法访问该目录,因此无法访问 403.14。您是否尝试使用模拟器发布到 /api/messages 端点?
-
我还了解到,根据 Drew 的建议,BOT 本身会在发布时生成 web.config 文件。抱歉回复晚了,但我的问题仍然存在。我添加了由 BOT 生成的 web.config 代码和日志。
-
@drew-marsh 任何帮助表示赞赏。
标签: azure iis botframework bots azure-bot-service