碰巧我花了一整天的时间来解决设置问题,现在我已经设置了 mvc4(从 WebForms 移动)和 vs2010 。
部署到 IIS(7 v7.5)后,除非我指定视图的完整路径,否则我无法加载项目。除了放置静态 html 或 aspx 页面
怎么可能让它重定向到 [MyFirstControl]/[MyFirstView]
是不是少了一个大师?是选择网站与 WebApplication 之间的问题吗?
我已将我的 Ip 连接到域名,在 FW 中为 iis 打开端口,我想要的只是能够通过其域名进入站点/应用程序,而不必拨入 control + view。所以我需要做什么?
顺便说一句,我正在使用基本模板,因为我想要最少的代码量,它是定义上的网站还是 Web 应用程序,作为 .NET 中的程序员,它真的很重要吗?没有网站是网站,而是应用程序,因为你永远不会只放 html,而是业务层和数据库..但我不明白名称/术语的区别
编辑
我已经用谷歌搜索了很长时间试图让它正确
<modules>
<remove name="UrlRoutingModule-4.0" />
<add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="" />
</modules>
<handlers>
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}