Is it possible to add a wildcard application map in IIS6 from the wix installer package? I know how to add application extensions however can't see any way to add wildcards.
This is needed for ASP.Net MVC to function properly.
Found the answer. You use the WebApplicationExtension (found in WixIisExtension), without specifying an Extension attribute. Here's the wildcard mapping for ASP.NET 2.0:
<iis:WebApplicationExtension CheckPath="no"
Script="yes"
Executable="[FRAMEWORKROOT]v2.0.50727\aspnet_isapi.dll"
Verbs="GET,HEAD,POST"/>
Related
Is it possible to compile the js file in asp.net or asp.net mvc like to support server side variables for example globalization or any other variables?
You may take a look at RazorJs. It also has a NuGet package available.
Spark View Engine supports this and actually works very well for this.
It allows you to use ~/ in your resource files URLs and translates it to the site root.
http://sparkviewengine.com/
Otherwise you could just write a Controller action that parses (and maybe compresses) those resource files for you. This can be made easy by using something like Packer.
I added wildcard mappings to my website in IIS 6.0 so that my MVC application works properly but now I get a page can not be found for every request. Once wildcard mappings are inserted I can not browse to a test html file I created or any of my routes.
The site works fine when the wildcard mappings are off and I create a application extention called .mvc which is then used in my routes however I woupld prefer not using the extension in the Url.
Here are some highlights of my setup, server, and application:
Windows Server 2003 with IIS 6.0:
.Net 3.5 SP1
Bin deployment for the MVC dll's
Server has mutiple sites running on it. With this particular one being set up as its own site (not a virtual directory).
The site uses forms authentication
When setting up the wildcard mappings I unchecked "verify file exists" and mapped to c:\windows\microsoft.net\framework\v2.0.050727\aspnet_isapi.dll.
The web service extensions where pointing to framework64. As soon as the wildcard mapping was pointing to the correct folder (framework64 instead of framework) it worked.
Url rewriting can help you to solve the problem. I've implemented solution allowing to deploy MVC application at any IIS version even when virtual hosting is used.
http://www.codeproject.com/KB/aspnet/iis-aspnet-url-rewriting.aspx
I have started a new mvc project and clicked on project\properties\web - use local IIS server (mine is 5.1). I've created a virtual directory all ok.
When I run I get a 403 error - in url http://localhost/myProjectName/
I have set IIS to windows integrated security and set web.config to windows.
My ultimate goal is to use mixed windows and forms authentication for an intranet app.
I appreciate any help.
I don't believe this will work off the bat for IIS 5.1. By default, MVC controllers/pages don't have extensions, and so IIS doesn't know who to forward the request to during the request pipeline.
In IIS 6.0, you can set a IIS wildcard mapping forward all unknown files to the ASP.NET engine. For 5.1, you'll probably have to configure MapRoutes so that your urls include the mvc extension:
http://localhost/myproject/home.mvc
It can work. Solution is not elegant but it does exist.
Take a look at my article IIS vs. ASP.NET URL Rewriting
For IIS6 I can use the IIS helpers in Wix to install a web application like this:
<iis:WebAppPool
Id="AP_MyApp"
Name="My Application Pool"
Identity="networkService" />
<iis:WebApplication
Id="WA_MyApp"
Name="MyApp"
WebAppPool="AP_MyApp">
<iis:WebApplicationExtension
CheckPath="no"
Executable="[NETFRAMEWORK20INSTALLROOTDIR]aspnet_isapi.dll"
Verbs="GET,HEAD,POST"/>
</iis:WebApplication>
Unfortunately, this doesn't work for IIS7. We don't want to use the aspnet_isapi.dll mechanism, and instead want the integrated pipeline to handle the request routing. The app pool created by this script is in Classic mode not Integrated mode so none of the handlers get run correctly.
How can I correctly install an MVC app on IIS 7?
I personally recommend using AppCmd.exe (matthewthurlow's first bullet) because you don't have to count on the legacy management components being installed, or risk modifying the configuration XML manually.
If you are not comfortable with AppCmd, Mike Volodarsky has a great article on Getting Started with AppCmd.exe, and the Microsoft IIS Configuration Reference is excellent, offering UI, Code and AppCmd examples for modifying each of the configuration items (e.g. Application Pools ). The IIS7 Administration Pack also includes a Configuration Editor that allows you to generate AppCmd scripts from any existing configuration.
To integrate AppCmd into WiX, you need to create and schedule two custom actions for each command. There is general information in the WiX v3 manual documenting this procedure, and I've included a concrete example below.
First, you need to set up an immediate action to store the command line in a property:
<CustomAction
Id="CreateAppPool_Cmd"
Property="CreateAppPool"
Execute="immediate"
Value=""[WindowsFolder]system32\inetsrv\APPCMD.EXE" add apppool /name:"[APP_POOL_NAME]"" />
Next you set up a deferred action which references this property:
<CustomAction
Id="CreateAppPool"
BinaryKey="WixCA"
DllEntry="CAQuietExec"
Execute="deferred"
Return="ignore"
Impersonate="no"/>
And finally, you need to schedule these. The immediate action that sets the properties seem to work well after InstallFinalize, and the deferred action works after InstallFiles. I haven't got as far as figuring out rollback actions yet.
MapGuide Open Source does this method extensively; you can see the CA scheduling in our MapGuide.wxs file, and the CA definition in our IIS7.wxs file.
Thanks to #matthewthurlow, I was able to use the XML utils to achieve what I needed to do:
<util:XmlFile
Id="ModifyAppPoolPipelineType"
Action="setValue"
ElementPath="//configuration/system.applicationHost/applicationPools/add[\[]#name='My Application Pool'[\]]/#managedPipelineMode"
File="[WindowsFolder]System32\inetsrv\config\applicationHost.config"
Value="Integrated"/>
The rest of the actions do seem to work fine with IIS 7.
The IIS extensions for WIX don't support IIS7. The IIS team keep rewriting the metabase between versions. There are quite a few things that don't work, the lack of an integrated app pool amongst them.
Until the extensions get rewritten, you're left with three options:
Use build in custom actions to invoke appcmd.exe
Use XmlConfig to update applicationHost.config
Write your own custom actions
I've opted for the xmlconfig option at the moment as you can do this within a component and tie it to a feature.
Let's assume we're talking about the recently released Beta version. Specifically I'm interested in a step-by-step tutorial or similar, and I'd be thrilled with information addressing how to do so on CrystalTech.
Ultimately you want a hosting environment that uses Windows Server 2008 / IIS7, which allows you configure things like mappings through the web.config rather than through IIS itself.
Failing that, your only choice is to either ask CrystalTech to enable ASP.NET wildcard mapping to your website or just stick with using .mvc extensions in your URLs.