【问题标题】:Start error with Microsoft Bot Framework, Visual Studio 2015 and 2017Microsoft Bot Framework、Visual Studio 2015 和 2017 的启动错误
【发布时间】:2018-08-27 00:26:35
【问题描述】:
  1. 已下载https://docs.microsoft.com/en-us/bot-framework/resources-tools-downloads 中所述的机器人模拟器和 vs 模板代码。

  2. 在我的 Windows 10 机器(版本:1703)上以管理员权限(以及具有相同最终结果的 VS 2017 [版本:15.2])启动 VS 2015 [版本:14 更新 3] 后创建了一个新的机器人应用程序; 操作系统版本:16199.1000)。

  3. 更新了所有 nuget 包。

  4. 按 F5 运行应用程序。我收到以下错误:

    “/”应用程序中的服务器错误。

    指定的参数超出了有效值的范围。 参数名称:网站

    说明:在执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。

    异常详细信息:System.ArgumentOutOfRangeException:指定的参数超出了有效值的范围。 参数名称:网站

    来源错误:

    在执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪来识别有关异常起源和位置的信息。

    堆栈跟踪:

    [ArgumentOutOfRangeException:指定的参数超出了有效值的范围。 参数名称:站点] System.Web.HttpRuntime.HostingInit(HostingEnvironmentFlags hostingFlags, PolicyLevel policyLevel, Exception appDomainCreationException) +280

    [HttpException (0x80004005): 指定的参数超出了有效值的范围。 参数名称:站点] System.Web.HttpRuntime.FirstRequestInit(HttpContext 上下文) +10041024 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext 上下文)+95 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254

  5. 应用程序事件日志包含以下信息:

    事件代码:3005 事件消息:发生未处理的异常。 活动时间:5/24/2017 11:36:28 PM 活动时间(UTC):5/25/2017 6:36:28 AM 事件 ID:9914b02cd15f4282b9043b1f70097b3e 事件顺序:1 事件发生:1 事件详情代码:0

    申请信息: 应用域:/LM/W3SVC/2/ROOT-1-131401677887853236 信任级别:
    应用程序虚拟路径:/ 应用路径:c:\users\User A\documents\visual studio 2017\Projects\MyFirstBotApp\MyFirstBotApp\ 机器名称:DESKTOP-BQ93HFB

    工艺信息: 进程号:14320 进程名称:iisexpress.exe 账户名:DESKTOP-BQ93HFB\用户A

    异常信息: 异常类型:ArgumentOutOfRangeException 异常消息:指定的参数超出了有效值的范围。 参数名称:站点 在 System.Web.Configuration.WebConfigurationHost.InitForConfiguration(String& locationSubPath, String& configPath, String& locationConfigPath, IInternalConfigRoot configRoot, Object[] hostInitConfigurationParams) 在 System.Configuration.Configuration..ctor(字符串 locationSubPath,类型 typeConfigHost,Object[] hostInitConfigurationParams) 在 System.Configuration.Internal.InternalConfigurationFactory.System.Configuration.Internal.IInternalConfigurationFactory.Create(类型 typeConfigHost,Object[] hostInitConfigurationParams) 在 System.Web.Configuration.WebConfigurationHost.OpenConfiguration(WebLevel webLevel,ConfigurationFileMap 文件映射,VirtualPath 路径,字符串站点,字符串 locationSubPath,字符串服务器,字符串用户名,字符串密码,IntPtr 令牌句柄) 在 System.Web.Configuration.WebConfigurationManager.OpenWebConfigurationImpl(WebLevel webLevel,ConfigurationFileMap 文件映射,字符串路径,字符串站点,字符串 locationSubPath,字符串服务器,字符串用户名,字符串密码,IntPtr 用户令牌) 在 System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironment(String appId, IApplicationHost appHost, HostingEnvironmentParameters hostingParameters) 在 System.Web.HttpRuntime.HostingInit(HostingEnvironmentFlags hostingFlags, PolicyLevel policyLevel, Exception appDomainCreationException)

    请求信息: 请求网址:http://localhost:3979/ 请求路径:/ 用户主机地址:::1 用户:
    是否经过身份验证:假 身份验证类型:
    线程账号名:DESKTOP-BQ93HFB\User A

    线程信息: 线程 ID:5 线程账号名:DESKTOP-BQ93HFB\User A 是否冒充:假 堆栈跟踪:在 System.Web.HttpRuntime.HostingInit(HostingEnvironmentFlags hostingFlags, PolicyLevel policyLevel, Exception appDomainCreationException)

  6. 我检查了 Web 选项卡下的项目属性。部署服务器设置为 IIS Express。我还验证了我安装了 10.0.14358.1000 版本的 IIS Express。 (注意:我可以毫无问题地运行和创建 Web Api 应用程序。)

不确定在此处还需要检查什么来解决问题。任何帮助表示赞赏。

【问题讨论】:

  • 对问题的描述非常好。我以前没有见过这个错误。您是否更新了 Visual Studio 中的所有扩展? (工具 -> 扩展和更新)
  • 是的,我这样做并更新了所有内容。还是没有骰子。

标签: visual-studio-2015 visual-studio-2017 botframework iis-express


【解决方案1】:

我不知道我需要安装一个名为“Internet Information Services Hostable Web Core”的 Windows 功能组件。一旦我安装了这个组件,它就可以正常工作了。不确定 IIS Express 与此组件有什么关系,以及为什么在已安装 IIS Express 时未启用它。奇怪!

【讨论】:

  • 我很高兴你能够让它工作。请接受你自己的答案。
【解决方案2】:

虽然上面的答案是正确的,但我在安装了 IIS Express 的 Windows 更新后遇到了这个错误。

卸载并重新安装 IIS 将解决此问题。由于某种原因,Windows 更新破坏了它,仅修复程序并不能解决问题。

【讨论】:

    【解决方案3】:

    几乎有同样的问题。

    安装 Windows 10 1709 更新后,盯着 VS 2015 花了一段时间。启动后,加载我的项目并按 F5 导致以下异常:

    Exception information: 
        Exception type: ArgumentOutOfRangeException 
        Exception message: Specified argument was out of the range of valid values.
    Parameter name: site
       at System.Web.Configuration.WebConfigurationHost.InitForConfiguration(String& locationSubPath, String& configPath, String& locationConfigPath, IInternalConfigRoot configRoot, Object[] hostInitConfigurationParams)
       at System.Configuration.Configuration..ctor(String locationSubPath, Type typeConfigHost, Object[] hostInitConfigurationParams)
       at System.Configuration.Internal.InternalConfigConfigurationFactory.System.Configuration.Internal.IInternalConfigConfigurationFactory.Create(Type typeConfigHost, Object[] hostInitConfigurationParams)
       at System.Web.Configuration.WebConfigurationHost.OpenConfiguration(WebLevel webLevel, ConfigurationFileMap fileMap, VirtualPath path, String site, String locationSubPath, String server, String userName, String password, IntPtr tokenHandle)
       at System.Web.Configuration.WebConfigurationManager.OpenWebConfigurationImpl(WebLevel webLevel, ConfigurationFileMap fileMap, String path, String site, String locationSubPath, String server, String userName, String password, IntPtr userToken)
       at System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironment(String appId, IApplicationHost appHost, HostingEnvironmentParameters hostingParameters)   at System.Web.HttpRuntime.HostingInit(HostingEnvironmentFlags hostingFlags, PolicyLevel policyLevel, Exception appDomainCreationException)
    

    首先,我关闭了我的 VS 并删除了 .vs 文件夹的内容。再次加载我的解决方案,VS 似乎正确地重新创建了配置,但仍然无法正常工作。

    其次,下载IIS 10 Express安装,卸载现有的,安装新的..似乎可以工作。

    但现在我的 SQL 服务器似乎无法正常工作,但那是另一回事了。

    【讨论】:

    • 这个有点不清楚,考虑修改格式。