ASP.NET MVC中路由配置中的Proplem [英] Proplem in route config in ASP.NET MVC

查看:99
本文介绍了ASP.NET MVC中路由配置中的Proplem的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我单独运行一个文件(ex.cshtml)然后它正常工作但当我将其设置为设置为起始页时,它将在'/'应用程序中给出服务器错误错误。



我尝试了什么:



工作前的网址是(http: // localhost:01234 / xyztables / ex)并在设置为设置为起始页面后,当它给出错误时,url为(http:// localhost:01234 / Views / xyztables / ex.cshtml)

when i am running individually a file (ex.cshtml) then it works correctly but when i make it as "set as start page" ,then it will give error of Server Error in '/' Application.

What I have tried:

the url before when it works is (http://localhost:01234/xyztables/ex) and after setting it as "set as start page" when it give error the url is (http://localhost:01234/Views/xyztables/ex.cshtml)

推荐答案

您不直接导航到查看文件。将项目属性中的起始页面设置为控制器和返回该视图的操作;



ControllerName / Actionname



设置为起始页选项实际上适用于webforms项目,而不是mvc项目。
You don't navigate to view files directly. Set the start page in the project properties to be the controller and action that returns that view;

ControllerName/Actionname

The "set as start page" option is really for webforms projects, not mvc ones.


这篇关于ASP.NET MVC中路由配置中的Proplem的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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