小编use*_*909的帖子

CS0234:System.Web命名空间中不存在Mvc

我根据专业ASP.NET 3.5 MVC的第13章,由Scott Hanselmen,Phil Haack和Rob Conery将一个ASP.net 4 webform项目转换为Asp.net MVC4,由Wiley Publishing,Inc.出版(ISBN:978-) 0-470-38461-9).我也关注了这个博客.现在我可以添加控制器,视图等.所有引用都设置正确.没有构建错误.但是在启动转换后的项目时,我遇到了编译错误.我在同一台机器上安装了mvc3.我甚至改变了对它的引用.它仍然抱怨.你能帮忙吗?谢谢.

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. 

Compiler Error Message: CS0234: The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)

Source Error:

Line 109:            <namespaces>
Line 110:                <add namespace="System.Web.Helpers"/>
Line 111:                <add namespace="System.Web.Mvc"/>
Line 112:                <add …
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc asp.net-mvc-4

37
推荐指数
6
解决办法
10万
查看次数

ELMAH没有记录违规的代码行号

我正在使用由NuGet pacakge经理设置的ELMAH默认配置.但是,ELMAH不提供有关我项目中违规代码行号的任何信息.相反,它提供了不是我编写的所有DotNet Framework程序集的堆栈跟踪.这根本没用.这是ELMAH生成的消息.我记得以前版本的ELMAH提供了有问题的行号.我没有正确设置吗?如果是,请如何配置它以便它更多地记录我的代码而不是DotNetFramework汇编代码.谢谢.

    System.NullReferenceException: Object reference not set to an instance of an object.
Generated: Wed, 01 May 2013 17:02:01 GMT

System.Web.HttpException (0x80004005): Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerWrapper'. ---> System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at CMT.Layout_Minimal.Page_Load(Object sender, EventArgs e)
   at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.HandleError(Exception e)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, …
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc elmah

11
推荐指数
1
解决办法
2574
查看次数

应用程序每15分钟编译一次

我在我的应用程序中使用ASP.Net4 MVC2.使用该应用程序的第一个人通常会在应用程序响应之前经历漫长的等待.之后,该应用程序非常敏感.如果应用程序闲置15分钟,则使用该应用程序的同一个人或下一个人将再次经历漫长的等待.看起来应用程序在空闲15分钟后编译.谁能告诉我应该在哪里找麻烦拍摄问题?谢谢.

iis asp.net-mvc application-pool recycle user-inactivity

9
推荐指数
2
解决办法
499
查看次数

混合组和用户的asp.net mvc [Authorize()]属性

我使用ASP.NET MVC 1.1与Windows身份验证.我试图只授权一个团体的成员和我自己.我不是该组的成员,也不需要成为该组的成员.每次访问网络应用程序的URL时,我都会收到Windows登录/密码提示.HomeController有

[HandleError]
[Authorize(Roles=@"MyDomain\\company.security.group.name")]  
[Authorize(Users=@"MyDoamin\\MyName")]
[OutputCache(Duration=86400,VaryByParam="PageIndex")]
public class HomeController : Controller
Run Code Online (Sandbox Code Playgroud)

我如何启用此类授权?Web应用程序在IIS6上的站点下运行.该站点具有目录安全性以接受匿名.Web应用程序/虚拟目录已禁用匿名并启用了Windows集成安全性.web.config有

c# authentication asp.net-mvc authorization

5
推荐指数
2
解决办法
1万
查看次数

更改 node.js 安装目录

我下载了 node.js v5.6.0 64bit 的 windows msi。当我执行它时,它弹出一个警告“无效的 E:驱动器”并关闭。没有办法更改安装驱动器。我没有 E: 驱动器,而是想安装到外部驱动器 F:。当我的外部驱动器设置为 E 时,我认为之前在 E: 驱动器上安装过。

node.js

5
推荐指数
3
解决办法
3409
查看次数

如何在 mat-tab 中启用 routerLink

我从 app-routing.module.ts 中延迟加载功能模块,如 Routing.module.ts 中所示。特色路由模块中的默认路由会加载包含 3 个子路由的 LccpTrackerComponent。LccpTrackerComponent 的模板使用 Angular Material 选项卡组件。我试图在 mat-tab 标题中添加 routerLink 指令以路由到相应的子组件,但该路由不会触发。有谁知道如何进行这项工作?谢谢。

模板

<article>
  <section>
    <mat-tab-group>
      <mat-tab label="Consults"><a routerLink="consults" /></mat-tab>
      <mat-tab label="Screening"><a routerLink="screening" /></mat-tab>
      <mat-tab label="Noduled"><a routerLink="noduled" /></mat-tab>
    </mat-tab-group>
  </section>
  <router-outlet></router-outlet>
</article>
Run Code Online (Sandbox Code Playgroud)

路由模块.ts

const routes: Routes = [{
  path: '',
  component: LccpTrackerComponent,
  children: [{
      path: 'consults',
      component: ConsultComponent,
      pathMatch: 'full',
      resolve: {
        consultSummary: LccpResolver
      }
    },
    {
      path: 'screening',
      component: ScreeningComponent,
      pathMatch: 'full',
      resolve: {
        enrolledSummary: ScreeningResolver
      }
    },
    {
      path: 'noduled',
      component: NoduledComponent,
      pathMatch: 'full', …
Run Code Online (Sandbox Code Playgroud)

angular

5
推荐指数
1
解决办法
8074
查看次数

AngularJS Uncaught TypeError:无法读取undefined的属性'replace'

当我的角度应用程序启动时,它会立即在Angular.js的第4414行引发错误(v1.4.3).在初始化(引导)阶段,似乎无法加载服务.当我按F5继续时,_Layout.chtml被加载.但是,ui-view不是从Index.cshtml加载的.这表示Home控制器未执行,因此未填充$ scope.它应该处于"Home"ui-state状态,但它没有使用url" http:// localhost/myApp / " 进入该状态.谢谢你的帮助.

来自Chrome控制台

trimEmptyHash@ angular.js: 11267
$get@ angular.js: 12096
invoke@ angular.js: 4450(anonymous
  function)@ angular.js: 4268
getService@ angular.js: 4409
invoke@ angular.js: 4441(anonymous
  function)@ angular.js: 4268
getService@ angular.js: 4409
invoke@ angular.js: 4441(anonymous
  function)@ angular.js: 4268
getService@ angular.js: 4409
invoke@ angular.js: 4441(anonymous
  function)@ angular.js: 4272
forEach@ angular.js: 336
createInjector@ angular.js: 4272
doBootstrap@ angular.js: 1630
bootstrap@ angular.js: 1651
angularInit@ angular.js: 1545(anonymous
  function)@ angular.js: 28359
jQuery.Callbacks.fire@ jquery - 2.1.4.js: 3099
jQuery.Callbacks.self.fireWith@ jquery - 2.1.4.js: 3211
jQuery.extend.ready@ jquery - 2.1.4.js: 3417 …
Run Code Online (Sandbox Code Playgroud)

angularjs

1
推荐指数
1
解决办法
5252
查看次数

属性类型在DBContext中不是有效的键类型

当WebAPI控制器尝试从存储库中获取数据时,出现了运行时错误(图1)。存储库构造函数注入了一个从DbContext继承的类(图2)。在DbSet中指定的POCO类(图3)指向SQL Server中的视图(图4)。在表的OnModelCreating()中,还指定了键。为什么错误仍然出现?谢谢。

图1:

System.InvalidOperationException occurred
  HResult=0x80131509
  Message=The property 'ConsultSID' cannot be used as 
  a key property on the entity 'ConsultTB' because the 
  property type is not a valid key type. Only scalar types, 
  string and byte[] are supported key types.
Run Code Online (Sandbox Code Playgroud)

图2:

namespace myOrg.Repository {
  public class MyDb: DbContext {
    public MyDb(): base("name=MyConnectionString") {}

    public virtual DbSet < ConsultTB > ConsultTBs {
      get;
      set;
    }

    protected override void OnModelCreating(DbModelBuilder modelBuilder) {
      modelBuilder.Entity < ConsultTB > ().ToTable("vConsultTB", "App");

      modelBuilder.Entity<ConsultTB>().HasKey(c => c.ConsultSID);
    } …
Run Code Online (Sandbox Code Playgroud)

c# entity-framework entity-framework-6

1
推荐指数
1
解决办法
1153
查看次数