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
相关文章
|
9天前
|
前端开发 Java 应用服务中间件
Springboot对MVC、tomcat扩展配置
Springboot对MVC、tomcat扩展配置
|
3月前
|
开发框架 前端开发 .NET
ASP.NET CORE 3.1 MVC“指定的网络名不再可用\企图在不存在的网络连接上进行操作”的问题解决过程
ASP.NET CORE 3.1 MVC“指定的网络名不再可用\企图在不存在的网络连接上进行操作”的问题解决过程
38 0
|
29天前
|
开发框架 前端开发 .NET
进入ASP .net mvc的世界
进入ASP .net mvc的世界
28 0
|
29天前
mvc.net分页查询案例——mvc-paper.css
mvc.net分页查询案例——mvc-paper.css
5 0
|
1月前
|
开发框架 前端开发 .NET
C# .NET面试系列六:ASP.NET MVC
<h2>ASP.NET MVC #### 1. MVC 中的 TempData\ViewBag\ViewData 区别? 在ASP.NET MVC中,TempData、ViewBag 和 ViewData 都是用于在控制器和视图之间传递数据的机制,但它们有一些区别。 <b>TempData:</b> 1、生命周期 ```c# TempData 的生命周期是短暂的,数据只在当前请求和下一次请求之间有效。一旦数据被读取,它就会被标记为已读,下一次请求时就会被清除。 ``` 2、用途 ```c# 主要用于在两个动作之间传递数据,例如在一个动作中设置 TempData,然后在重定向到另
95 5
|
3月前
|
XML 前端开发 定位技术
C#(NET Core3.1 MVC)生成站点地图(sitemap.xml)
C#(NET Core3.1 MVC)生成站点地图(sitemap.xml)
25 0
|
3月前
|
前端开发
.net core mvc获取IP地址和IP所在地(其实是百度的)
.net core mvc获取IP地址和IP所在地(其实是百度的)
123 0
|
3月前
|
前端开发 Java Spring
【Spring MVC】SpringMVC自动配置
【1月更文挑战第14天】【Spring MVC】SpringMVC自动配置
|
4月前
|
前端开发 JavaScript Java
Spring Boot中Spring MVC的基本配置讲解与实战(包括静态资源配置,拦截器配置,文件上传配置及实战 附源码)
Spring Boot中Spring MVC的基本配置讲解与实战(包括静态资源配置,拦截器配置,文件上传配置及实战 附源码)
49 1
|
4月前
|
XML 前端开发 JavaScript
SpringMVC中单独配置<mvc:default-servlet-handler/> 导致 Controller失效
SpringMVC中单独配置<mvc:default-servlet-handler/> 导致 Controller失效
75 0