本文介绍了Bot发布到Azure并收到内部服务器错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我一直在使用Bot Framework SDK v4创建聊天机器人.我已经在本地对其进行了测试,并且可以与Bot仿真器配合使用.

我希望能够将其托管在Azure上并进行远程访问,但是当我发布它并且浏览器打开我的azurewebsites.net网页时,该页面仅显示错误消息:启动应用程序时发生错误."

当我查看控制台以检查错误时,有2个资源加载请求失败:


   无法加载资源:服务器的状态为500(内部服务器错误)/favicon.ico:1 
   无法加载资源:服务器的响应状态为500(内部服务器错误)(索引):1

这是我第一次使用或发布某些内容到Azure,所以我对此不太熟悉.据我所知,这些名称下的本地目录中没有任何文件,而且我不确定如何解决此问题.

关于什么原因的想法?如果需要,我可以提供更多代码.

So I've been creating a chatbot using the Bot Framework SDK v4. I've been testing it locally and it works fine with the Bot Emulator.

I want to be able to host it on Azure and access it remotely but when I publish it and the browser opens up my azurewebsites.net webpage, the page just displays an error saying **An error occurred while starting the application.**

When I look at the console to inspect the error, there are 2 requests for resources that fail to load:


    Failed to load resource: the server responded with a status of 500 (Internal Server Error) /favicon.ico:1 
    Failed to load resource: the server responded with a status of 500 (Internal Server Error) (index):1

This is my first time using or publishing something to Azure so I'm not overly familiar with it. As far as I know, there aren't any files in my local directory under those names, and I'm not sure how to rectify the issue.

And idea's as to whats causing this? I can provide more code if needed.

我从Application Insights和Kudu收集了更多信息.

尝试使用``测试Web应用程序''向Azure中的bot发送消息时,我抛出了以下异常:


    System.IO.FileNotFoundException:找不到文件'D:\ home \ site \ wwwroot \ Chatbot.bot'.
     文件名:'D:\ home \ site \ wwwroot \ Chatbot.bot'
      at System.IO.FileStream.OpenHandle(FileMode模式,FileShare共享,FileOptions选项)
   在System.IO.FileStream..ctor中(字符串路径,FileMode模式,FileAccess访问,FileShare共享,Int32 bufferSize,FileOptions选项)
      at System.IO.StreamReader..ctor(字符串路径,编码编码,布尔型detectEncodingFromByteOrderMarks,Int32 bufferSize)
      at System.IO.File.OpenText(String path)
      at Microsoft.Bot.Configuration.BotConfiguration.< LoadAsync> d__31.MoveNext()
      ---从上一个引发异常的位置开始的堆栈跟踪---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)
      at Microsoft.Bot.Configuration.BotConfiguration.Load(字符串文件,字符串机密)
    <> c__DisplayClass6_0.< ConfigureServices> b__0(BotFrameworkOptions选项)位于C:\ Users \ Marko \ Documents \ Project \ ChatBotProject \ ChatBotProject \ Startup.cs:line 47
      at Microsoft.Extensions.Options.ConfigureNamedOptions`1.Configure(字符串名称,TOptions选项)
      at Microsoft.Extensions.Options.OptionsFactory`1.Create(String name)
      at Microsoft.Extensions.Options.OptionsManager`1.<> c__DisplayClass5_0.< Get> b__0()
      at System.Lazy`1.ViaFactory(LazyThreadSafetyMode模式)
      at System.Lazy`1.ExecutionAndPublication(LazyHelperexecutionAndPublication,布尔值使用DefaultConstructor)
      at System.Lazy`1.CreateValue()
      at Microsoft.Extensions.Options.OptionsCache`1.GetOrAdd(字符串名称,Func`1 createOptions)
      at Microsoft.Extensions.Options.OptionsManager`1.Get(String name)
      at Microsoft.Extensions.Options.OptionsManager`1.get_Value()
      at Microsoft.Bot.Builder.Integration.AspNet.Core.ApplicationBuilderExtensions.UseBotFramework(IApplicationBuilder applicationBuilder)
   在C:\ Users \ Marko \ Documents \ Project \ ChatBotProject \ ChatBotProject \ Startup.cs:line 122
中的ChatBotProject.Startup.Configure(IApplicationBuilder应用程序,IHostingEnvironment env,ILoggerFactory loggerFactory)中      ---从上一个引发异常的位置开始的堆栈跟踪---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder应用)
     在Microsoft.AspNetCore.ApplicationInsights.HostingStartup.ApplicationInsightsLoggerStartupFilter.<> c__DisplayClass0_0.<配置> b__0(IApplicationBuilder构建器)
     在Microsoft.ApplicationInsights.AspNetCore.ApplicationInsightsStartupFilter.<> c__DisplayClass0_0.<配置> b__0(IApplicationBuilder应用)
     在Microsoft.AspNetCore.Server.IISIntegration.IISSetupFilter.<> c__DisplayClass3_0.<配置> b__0(IApplicationBuilder应用)
     在Microsoft.AspNetCore.Hosting.Internal.AutoRequestServicesStartupFilter.<> c__DisplayClass0_0.<配置> b__0(IApplicationBuilder构建器)
      at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()

此外,通过检查Kudu中的日志,该html对可能的原因进行了描述:

    < fieldset>
    < h4>最可能的原因:</h4>
    < ul>
        < li> IIS收到了请求;但是,在处理请求期间发生内部错误.
           此错误的根本原因取决于哪个模块处理请求以及工作程序中发生了什么
            </li>
,在发生此错误时进行处理.        < li> IIS无法访问网站或应用程序的web.config文件.如果是NTFS,则会发生这种情况
           权限设置不正确.</li>
        < li> IIS无法处理网站或应用程序的配置.</li>
        < li>经过身份验证的用户无权使用此DLL.</li>
        < li>该请求已映射到托管处理程序,但未安装.NET扩展功能.</li>
    </ul>
</fieldset>

More information I've gathered from Application Insights and Kudu.

When trying to send a message to the bot in Azure using the 'Test Web App​', I'm getting these exceptions thrown:


    System.IO.FileNotFoundException: Could not find file 'D:\home\site\wwwroot\Chatbot.bot'.
     File name: 'D:\home\site\wwwroot\Chatbot.bot'
     at System.IO.FileStream.OpenHandle(FileMode mode, FileShare share, FileOptions options)
     at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
     at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize)
     at System.IO.File.OpenText(String path)
     at Microsoft.Bot.Configuration.BotConfiguration.<LoadAsync>d__31.MoveNext()
     --- End of stack trace from previous location where exception was thrown ---
     at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
     at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
     at Microsoft.Bot.Configuration.BotConfiguration.Load(String file, String secret)
     at ChatBotProject.Startup.<>c__DisplayClass6_0.<ConfigureServices>b__0(BotFrameworkOptions options) in C:\Users\Marko\Documents\Project\ChatBotProject\ChatBotProject\Startup.cs:line 47
     at Microsoft.Extensions.Options.ConfigureNamedOptions`1.Configure(String name, TOptions options)
     at Microsoft.Extensions.Options.OptionsFactory`1.Create(String name)
     at Microsoft.Extensions.Options.OptionsManager`1.<>c__DisplayClass5_0.<Get>b__0()
     at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
     at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
     at System.Lazy`1.CreateValue()
     at Microsoft.Extensions.Options.OptionsCache`1.GetOrAdd(String name, Func`1 createOptions)
     at Microsoft.Extensions.Options.OptionsManager`1.Get(String name)
     at Microsoft.Extensions.Options.OptionsManager`1.get_Value()
     at Microsoft.Bot.Builder.Integration.AspNet.Core.ApplicationBuilderExtensions.UseBotFramework(IApplicationBuilder applicationBuilder)
     at ChatBotProject.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) in C:\Users\Marko\Documents\Project\ChatBotProject\ChatBotProject\Startup.cs:line 122
     --- End of stack trace from previous location where exception was thrown ---
     at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
     at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app)
     at Microsoft.AspNetCore.ApplicationInsights.HostingStartup.ApplicationInsightsLoggerStartupFilter.<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder builder)
     at Microsoft.ApplicationInsights.AspNetCore.ApplicationInsightsStartupFilter.<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder app)
     at Microsoft.AspNetCore.Server.IISIntegration.IISSetupFilter.<>c__DisplayClass3_0.<Configure>b__0(IApplicationBuilder app)
     at Microsoft.AspNetCore.Hosting.Internal.AutoRequestServicesStartupFilter.<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder builder)
     at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()

Furthermore, from checking the logs in Kudu, the html has a description of what the cause might be:

    <fieldset>
    <h4>Most likely causes:</h4>
    <ul>
        <li>IIS received the request; however, an internal error occurred during the processing of the request. The
            root cause of this error depends on which module handles the request and what was happening in the worker
            process when this error occurred.</li>
        <li>IIS was not able to access the web.config file for the Web site or application. This can occur if the NTFS
            permissions are set incorrectly.</li>
        <li>IIS was not able to process configuration for the Web site or application.</li>
        <li>The authenticated user does not have permission to use this DLL.</li>
        <li>The request is mapped to a managed handler but the .NET Extensibility Feature is not installed.</li>
    </ul>
</fieldset>

对此将提供任何帮助

推荐答案

当您的wwwroot文件夹中的文件完全正确时,就会发生运行时问题它们应该是什么,但是由于某种原因该站点无法正常运行.您可以结帐 以帮助纠正此问题. 

A runtime issue happens when the files in your wwwroot folder are exactly what they should be, but for some reason the site doesn't run correctly. You may checkout the suggestions outlined in Deployment vs runtime issuesto help rectify the issue. 


这篇关于Bot发布到Azure并收到内部服务器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 13:06