asp.net - 浏览器链接在 Visual Studio 2015 社区中不起作用

标签 asp.net visual-studio-2015

我刚刚开始使用 Visual Studio,并尝试复制 Bob Tabor 的教程。尝试使用浏览器连接显示 HTML 文件。

这就是我正在做的事情:

  1. 新项目
  2. Web ASP.NET Web 应用程序
  3. 添加新项目 --> HTML 页面
  4. 将“test”添加到标题和正文
  5. 尝试在浏览器中查看 - 获取 http://localhost:51962/HtmlPage1.html 没有回应

浏览器仪表板显示没有连接

添加到 web.config:

<system.webServer>    
<handlers>
  <add name="Browser Link for HTML" path="*.html" verb="*" 
       type="System.Web.StaticFileHandler, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" 
       resourceType="File" preCondition="integratedMode" />
</handlers>
</system.webServer>

但似乎没有任何作用。有人可以提供正确的步骤吗?

我认为这可能是服务器问题。 localhost 是一个到 MySQL 数据库的连接,称为最终项目。 BlueWater 是我电脑的名称。我能够连接到 Mysql 数据库。我确保我使用的是 4.5.2 并且我们的 web.config 文件匹配。再次感谢你的帮助。这是服务器资源管理器的屏幕截图:

enter image description here

最佳答案

我尝试重现您的问题,结果符合预期。让我添加屏幕截图,以便您可以跟进。我在 Windows 10 上使用带有 4.5.2 .NET Framework 的 Visual Studio 2015 Community。

开始一个新项目

Starting a new project

选择项目类型

Choosing the type of project

添加 HTML 页面

Adding an HTML page

向 HTML 页面添加测试 (点击Google Chrome运行项目)

Adding test to HTML page

运行项目

Running the project

我的 Web.config 如下所示:

<?xml version="1.0" encoding="utf-8"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.5.2"/>
    <httpRuntime targetFramework="4.5.2"/>
  </system.web>
  <system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs"
        type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701"/>
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
        type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+"/>
    </compilers>
  </system.codedom>
</configuration>

你能复制这些步骤吗?

编辑:DCR 和我无法让 IISExpress 显示网页。因此,我们决定对多个区域进行故障排除。这是有效的。

  • IIS 网络服务器正在运行,因此我们决定利用它(如果您don't have IIS you can install it转至“开始”>“控制面板”>“程序”>“打开或关闭 Windows 功能”> 选择“Internet 信息服务”>“确定”)。
  • 我们访问 http://localhost 并确保可以看到 IIS 欢迎页面
  • 我们关闭了 Visual Studio 2015 社区并以管理员身份重新打开它
  • 右键单击 WebApplication1 项目。单击“属性”
  • 点击左侧菜单上的“Web”
  • 已选择开始操作。单击椭圆 (...) 按钮并选择 HtmlPage1.html 页面
  • 在服务器下有一个下拉菜单。选择本地IIS。项目 URL 更改为 http://localhost/WebApplication1
  • 单击创建虚拟目录。成功消息已注意到
  • 保存项目更改
  • 按 F5
  • 页面根据需要显示在 http://localhost/WebApplication1/URL

https://chat.stackoverflow.com/rooms/97122/discussion-between-dcr-and-zedfoxus还有更多东西可以帮助其他人解决类似问题。

已尝试审核 Unable to launch the IIS Express Web server 的答案还有来源。

关于asp.net - 浏览器链接在 Visual Studio 2015 社区中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34073197/

相关文章:

c# - 为什么我的一些类名在新的 VS 2015 编译器中返回为 "<>c"?

c++ - 多文件 <iostream> 错误 LNK2005 in VS2015 with/Za

asp.net - File.ReadAllLines 线程安全吗?

asp.net - 如何在asp.net MVC中制作多语言网站?

visual-studio-2015 - Visual Studio错误microsoft.vshub.server.httphostx64.exe

c# - 动态母版页,可以访问两个母版中的变量

python-3.x - 如何将 Tkinter 安装到 Visual Studio 2015

asp.net - ASP.NET 中 Excel 工作表的日期时间解析

c# - 使用 WCF 服务从 ASP.NET 应用程序进行串行端口通信

c# - MVC5 ViewModel 不回发到 Controller