添加控制器时“没有可用的模型类”被展示 [英] when adding controllers "no model class available" is displayed

查看:135
本文介绍了添加控制器时“没有可用的模型类”被展示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我尝试添加控制器时,都不会显示可用的模型类。我尝试添加模型但弹出错误

进程无法访问文件.C:\users \Sony \ AppData \ Local \Temp \owblaa1w.zf \ Model11.tt因为它被另一个进程使用

plz help

解决方案

如果您自己创建了该文件,则忘记关闭该流。如果Visual Studio正在使用它,重新启动系统有很多可能正在使用这些文件的地下进程,甚至在任务管理器中你也不知道哪个进程正在使用它。 (我不知道在 <$ c $中这样做c>诊断 [ ^ ]命名空间



所以唯一的选择留给你(第二个问题)添加模型)将关闭Visual Studio并重新启动计算机。第一个问题的解决方案是,当您创建一个新的Controller时,您将获得一些选项,尝试删除当前的模型选择,看看是否有效。



如果在不使用模型的情况下创建控制器,则问题确实存在于该文件中。使用此方法,您可以在方式之后将模型添加到视图中(视图中需要模型,仅在控制器中用于数据验证和其他检查)。


< blockquote>你好,



我不知道标题与它有什么关系,但关于你的问题,如果你有Avast反病毒,从不花时间搜索关于因为它被另一个进程使用,然后尝试使用Avast停用。


whenever i try to add controllers no modeel class available is displayed. i tried adding models but error is popped
"the process cannot access file. C:\users\Sony\AppData\Local\Temp\owblaa1w.zf\Model1.tt because it is used by another process"
plz help

解决方案

If you created the file yourself, you forgot to close the stream. If Visual Studio is using it, restart your system there are a lot of underground processes that might be using the files, and even in Task Manager you would have no idea which of the process is using it. (I have no idea of doing this in Diagnostics[^] namespace)

So the only option left for you (for the second problem of adding a model) would be to close the Visual Studio and restart the machine. The solution to first problem is, when you are creating a new Controller, you are provided with a few options, try removing the Model selection at the time and see if that works.

If controller is created without using a Model, then the problem is indeed with that file. Using this method, you can after ways add the model to your views (Models are required in Views, and in controllers only for data validations and other check ups).


Hello,

I do not know what the title has to do with it, but about your question, if you have Avast anti-virus, never spend time searching about "because it is used by another process" before trying with Avast dis-activated.


这篇关于添加控制器时“没有可用的模型类”被展示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆