apache支持asp.net的模块mod_aspdotnet的BUG修复及重编译

apache上面运行.net是突出奇想,然后到网上找了一下,确实有支持,下载下来用了一下,有一些小的BUG,比如写入多个COOKIE只有最后一个COOKIE被写入成功,如果要真正使用这个组件的话,这点是必须修复的,还好在网上找到了mod_aspdotnet的源代码,我用的apache的版本是2.2,于是就把源代码打开把BUG修正了,然后重新编译得到两个文件.

其实我编译的时候花了不少工夫.最终找到官方管理员,请教半天才弄出来,这也是我现在要把我重新编译的两个文件贴出来的主要原因.

编译环境可以是XP或更高版本,vs2005或更高版本,apache2.2

编译的时候不能用批处理编译,要用vs的命令行

  set APACHE22_PATH=e:\apache2.2

设置环境变量,就是apache2.2的目录,安装apache的时候千万注意,要完整的安装,有一个什么headers的可选项一定要选上,要不然编译不成功的.


  devenv mod_aspdotnet.sln /useenv /build "Release 2.2" /project mod_aspdotnet

编译好后有两个文件,一个是Apache.Web.dll,加入windows GAC就OK了,

mod_aspdotnet.so放到apache下面的modules目录中的

mod_aspdotnet下载地址

这是官方示例的配置文件,具体的可以到其他网站上再看一下,容易找.这里就不写了.

# Load the Apache mod_aspdotnet.so module
#   - which in turn loads the .NET / ASP.NET Framework
#      - which in turn loads the Apache.Web.dll provider
#
LoadModule aspdotnet_module "modules/mod_aspdotnet.so"

<IfModule mod_aspdotnet.cpp>
 
  # A specific version of the .NET Common Language Runtime may be forced
  # with the AspNetVersion directive; uncomment one of the lines below
  # for the v1.0 or v1.1 general release versions, and refer to the
  # C:/WINDOWS/Microsoft.NET/Framework directory for installed versions.
  # The default is the most recent installed .NET CLR version.
  #
  #AspNetVersion v1.0.3705
  #AspNetVersion v1.1.4322

  # Appear consistent with other ASP.NET hosts to the client.
  # This is optional, unaware of client applications expecting it.
  #
  Header Add X-Powered-By ASP.NET

  # Process these file types with the asp.net handler
  # (provided they fall within an AspNetMount'ed location)
  #
  AddHandler asp.net asax ascx ashx asmx aspx axd config cs csproj \
                     licx rem resources resx soap vb vbproj vsdisco webinfo

  # Serve the /aspnet_client files to the web browser, to handle
  # JavaScript controls integrated into ASP.NET applications.
  #
  AliasMatch "^/(?i)aspnet_client/system_web/(\d+)_(\d+)_(\d+)_(\d+)/(.*)" \
             "C:/Windows/Microsoft.NET/Framework/v$1.$2.$3/ASP.NETClientFiles/$4"

  # Permit the /aspnet_client files to be served to web clients.
  # Change C:/Windows above in the AliasMatch, and below in the <Directory >
  # line to reflect the root of Windows (echo %windir% from the cmd prompt.)
  #
  <Directory "C:/Windows/Microsoft.NET/Framework/v*/ASP.NETClientFiles">
    Options FollowSymlinks
    Order allow,deny
    Allow from all
  </Directory>

  # This <IfDefine > prevents Apache from processing this example
  # template, duplicate the contents (adjusting for your desired
  # /app-uri and C:/path/to/app) as many times as necessary, but
  # not within the <IfDefine > ... </IfDefine> section
  #
  <IfDefine ASP.NET-template>

    # Create an ASP.NET host for Requests to /app-uri to be processed
    # by c:/path/to/app - see the Alias below for actually serving
    # /app-uri from Apache.
    # This is usually the path of the web.config file for the app.
    #
    AspNetMount /app-uri "C:/path/to/app"

    # Have Apache serve /app-uri requests with c:/path/to/app mounted hosted
    # Some form of Alias is required, AspNetMount does not expose /app-uri
    # itself, through Apache.
    #
    Alias /app-uri "C:/path/to/app"

    # Permit content in C:/path/to/app to be served (and use ASP.NET
    # conventions for the default pages.)
    #
    <Directory "C:/path/to/app">
      # Add 'Indexes'  to Options below for autoindex file listings
      # Add 'Includes' to Options below for SSI reparsing
      Options FollowSymlinks
      # Add 'Virtual' to AspNet below for non-file resources
      AspNet Files
      Order allow,deny
      Allow from all
      DirectoryIndex default.htm default.aspx
    </Directory>

  </IfDefine>

</IfModule>

原文地址:https://www.cnblogs.com/shaoming01/p/mod_aspdotnet.html