ASP.NET开源MVC框架Vici MVC(一)配置

简介: asp.net开源mvc框架 Vici的最大特征是支持ASP.NET2.0和IIS不需要额外的设置 例子的下载地址http://viciproject.com/wiki/projects/mvc/Download 现在大把大把的ASP.

asp.net开源mvc框架 Vici的最大特征是支持ASP.NET2.0和IIS不需要额外的设置

例子的下载地址http://viciproject.com/wiki/projects/mvc/Download

现在大把大把的ASP.NET MVC框架都需要 iis进行额外的设置 而vici却不需要,为什么呢

看看他的配置文件Web.config

<?xml version="1.0"?>
<configuration>

    <appSettings>
      <add key="Mvc.ApplicationClass" value="ViCiCore.Application,ViCiCore" />
      <add key="Mvc.TemplatePath" value="Content/templates" />
    </appSettings>
  
    <connectionStrings />
    <system.web>
        <compilation debug="true">
        </compilation>

      <globalization  requestEncoding="utf-8" fileEncoding="utf-8" />
      <httpModules>
        <add name="MvcModule" type="Vici.Mvc.HttpModule, Vici.Mvc" />
      </httpModules>

      <httpHandlers>
        <add verb="*" type="Vici.Mvc.MVCHandler, Vici.Mvc" path="ProMesh.axd" />
      </httpHandlers>
        <!--
            The <authentication> section enables configuration 
            of the security authentication mode used by 
            ASP.NET to identify an incoming user. 
        -->
        <authentication mode="Windows" />
        <!--
            The <customErrors> section enables configuration 
            of what to do if/when an unhandled error occurs 
            during the execution of a request. Specifically, 
            it enables developers to configure html error pages 
            to be displayed in place of a error stack trace.

        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
            <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" />
        </customErrors>
        -->

    </system.web>


  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <directoryBrowse enabled="true" />

    <modules runAllManagedModulesForAllRequests="true">
      <add name="MvcModule" type="Vici.Mvc.HttpModule, Vici.Mvc" />
    </modules>

    <handlers>
      <add name="MvcHandler" preCondition="integratedMode" verb="*" path="ProMesh.axd" type="Vici.Mvc.MVCHandler, Vici.Mvc" />
    </handlers>

  </system.webServer>

</configuration>

 

 

 

注意appSettings节点,httpModules节点,httpHandlers节点

    <appSettings>
      <add key="Mvc.ApplicationClass" value="ViCiCore.Application,ViCiCore" />
      <add key="Mvc.TemplatePath" value="Content/templates" />
    </appSettings>

     <httpModules>
        <add name="MvcModule" type="Vici.Mvc.HttpModule, Vici.Mvc" />
      </httpModules>

      <httpHandlers>
        <add verb="*" type="Vici.Mvc.MVCHandler, Vici.Mvc" path="ProMesh.axd" />
      </httpHandlers>

可见 vici是基于httpModules和httpHandlers的

<appSettings>节点中 第一个对应一个类 第二个对应模板的文件夹

看看ApplicationClass这个类有设么东西

 public static class Application
    {
        public static void Init()
        {

            WebAppConfig.Router.AddDefaultRoutes(".aspx"); // ".aspx"
          
        }
    }

 

是一个初始化的,用来初始化默认路由 和 对什么类型的后缀名进行路由 选择.aspx就不用iis而外的设置

默认的路由和微软的mvc差不多 有以下几种

URL Controller Action Parameters
~/{controller}/{action}/{id} {controller} {action} id = {id}
~/{controller}/{action} {controller} {action}  
~/{controller} {controller} Run  

vici的配置还是蛮简单的吐舌笑脸

test
相关文章
|
25天前
|
开发框架 .NET C#
ASP.NET Core Blazor 路由配置和导航
大家好,我是码农刚子。本文系统介绍Blazor单页应用的路由机制,涵盖基础配置、路由参数、编程式导航及高级功能。通过@page指令定义路由,支持参数约束、可选参数与通配符捕获,结合NavigationManager实现页面跳转与参数传递,并演示用户管理、产品展示等典型场景,全面掌握Blazor路由从入门到实战的完整方案。
177 6
|
8月前
|
Shell 网络安全 C#
一款 .NET 开源、功能强大的远程连接管理工具,支持 RDP、VNC、SSH 等多种主流协议!
一款 .NET 开源、功能强大的远程连接管理工具,支持 RDP、VNC、SSH 等多种主流协议!
271 4
|
9月前
|
人工智能 自然语言处理 数据中心
D1net阅闻|DeepSeek开源放大招:FlashMLA让H800算力狂飙!曝光低成本秘笈
D1net阅闻|DeepSeek开源放大招:FlashMLA让H800算力狂飙!曝光低成本秘笈
|
10月前
|
开发框架 前端开发 .NET
一个适用于 .NET 的开源整洁架构项目模板
一个适用于 .NET 的开源整洁架构项目模板
184 26
|
11月前
|
区块链 C# Windows
PasteEx:一款.NET开源的Windows快捷粘贴神器
PasteEx:一款.NET开源的Windows快捷粘贴神器
162 17
|
11月前
|
XML C# 数据格式
一个.NET开源、免费、功能强大的 PDF 处理工具
一个.NET开源、免费、功能强大的 PDF 处理工具
330 8
|
11月前
|
Web App开发 C# Windows
一款.NET开源的Windows资源管理器标签页工具
一款.NET开源的Windows资源管理器标签页工具
162 5
|
11月前
|
监控 前端开发 API
一款基于 .NET MVC 框架开发、功能全面的MES系统
一款基于 .NET MVC 框架开发、功能全面的MES系统
320 5
|
开发框架 前端开发 .NET
ASP.NET CORE 3.1 MVC“指定的网络名不再可用\企图在不存在的网络连接上进行操作”的问题解决过程
ASP.NET CORE 3.1 MVC“指定的网络名不再可用\企图在不存在的网络连接上进行操作”的问题解决过程
433 0
|
开发框架 前端开发 JavaScript
ASP.NET MVC 教程
ASP.NET 是一个使用 HTML、CSS、JavaScript 和服务器脚本创建网页和网站的开发框架。
226 7