Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/329.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 断点当前不会被命中,cshtml_C#_Razor - Fatal编程技术网

C# 断点当前不会被命中,cshtml

C# 断点当前不会被命中,cshtml,c#,razor,C#,Razor,在我的Asp.NETRazor应用程序中,我不断得到断点,但当前不会被击中。我尝试了这里的每一个解决方案,但没有成功。那么我接下来该怎么办 一些信息: 我正在使用调试模式 我正在使用Nancy.Templates创建一个NancyFx项目 创建的项目被设置为类库 当我在代码运行时找到模块时,它是从 出于某种原因 我尝试了所有可能的事情,清洁重建,创造新的新鲜事物 要测试的项目,重新安装visual studio,甚至windows。不 工作 我在Windows 8.1上运行,使用Visual S

在我的Asp.NETRazor应用程序中,我不断得到断点,但当前不会被击中。我尝试了这里的每一个解决方案,但没有成功。那么我接下来该怎么办

一些信息:

  • 我正在使用调试模式
  • 我正在使用Nancy.Templates创建一个NancyFx项目
  • 创建的项目被设置为类库
  • 当我在代码运行时找到模块时,它是从 出于某种原因
  • 我尝试了所有可能的事情,清洁重建,创造新的新鲜事物 要测试的项目,重新安装visual studio,甚至windows。不 工作
  • 我在Windows 8.1上运行,使用Visual Studio 2013 Ultimate.Net 4.5.1
  • 这是我的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>
      <configSections>
        <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
          <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
        </sectionGroup>
      </configSections>
    
      <!--
        For a description of web.config changes see http://go.microsoft.com/fwlink/?LinkId=235367.
    
        The following attributes can be set on the <httpRuntime> tag.
          <system.Web>
            <httpRuntime targetFramework="4.5.1" />
          </system.Web>
      -->
      <system.web>
        <compilation debug="true" targetFramework="4.5.1">
    
        <buildProviders>
            <add extension=".cshtml" type="Nancy.ViewEngines.Razor.BuildProviders.NancyCSharpRazorBuildProvider, Nancy.ViewEngines.Razor.BuildProviders" />
            <add extension=".vbhtml" type="Nancy.ViewEngines.Razor.BuildProviders.NancyVisualBasicRazorBuildProvider, Nancy.ViewEngines.Razor.BuildProviders" />
          </buildProviders></compilation>
    
        <pages controlRenderingCompatibilityVersion="4.0" />
      <httpHandlers>
          <add verb="*" type="Nancy.Hosting.Aspnet.NancyHttpRequestHandler" path="*" />
        </httpHandlers></system.web>
    
    
    
    <system.webServer>
        <validation validateIntegratedModeConfiguration="false" />
        <httpErrors existingResponse="PassThrough" />
        <handlers>
          <add name="Nancy" verb="*" type="Nancy.Hosting.Aspnet.NancyHttpRequestHandler" path="*" />
        </handlers>
      </system.webServer><appSettings>
        <add key="webPages:Enabled" value="false" />
      </appSettings><system.web.webPages.razor>
        <pages pageBaseType="Nancy.ViewEngines.Razor.NancyRazorViewBase">
          <namespaces>
            <add namespace="Nancy.ViewEngines.Razor" />
          </namespaces>
        </pages>
      </system.web.webPages.razor></configuration>
    
    
    
    以下是我在解决方案中唯一的.cshtml文件:

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>@ViewBag.Title</title> //Here is the break point (i am able to add it) however when i start the application and browser run the breakpoint is not being hit
    
        <style type="text/css">
    
            body { 
                text-align: center;
            }
    
        </style>
    
    </head>
    <body>
        <img src="~/Content/nancy-logo.png" alt="Nancy logo" /><br />
        This view was rendered using the Nancy Razor view engine
    </body>
    </html>
    
    
    @ViewBag.Title//这里是断点(我可以添加它),但是当我启动应用程序并运行浏览器时,断点没有被命中
    正文{
    文本对齐:居中;
    }
    
    此视图是使用Nancy Razor视图引擎渲染的
    问题图片:

    项目的pdb文件已存在


    如果没有一个控制器连接到调用.cshtml视图的视图,那么它将永远不会被加载。

    让我们来看看。