Jun 11, 2008

Posted by in Tech Tips | 9 Comments

Running other web applications inside Dynamics CRM 4.0 (32 or 64 bit)

As I mentioned in my previous post (here) we have been trying to run our custom CRM extensions inside the main IIS website (IIS 7.0) for Dynamics CRM 4.0. This means that when publishing the website to the Internet we don’t have any issues with users making requests to different sites etc… In this post I’ll run through the solution I found for running custom aspx & asp pages in separate web applications under the main CRM website as well as talking about the issues I encountered along the way. In our scenario one of the custom web applications needed to be run as a 32bit web application where as our server was running 64bit Dynamics, this will be the scenario I will focus on for this guide however I did end up with two custom web applications, one for 32bit and one for 64bit so any other iteration should be possible.


traffic diagram - blocked second site


traffic diagram showing sub folder with allowed traffic

How to implement the solution

Create your new web applications

The first thing you want to do is create yourself two new applications pools, one for 32bit and one for 64bit, these should be separate from the CRM web application. This was covered in my last post so see here for more information.

Tidy up 64bit extensions

Having created your 32bit child web application and then trying to browse to the site you will probably get the following error:

“Calling LoadLibraryEX on ISAPI filter “C:\Program Files\Microsoft Dynamics CRM\Server\bin\DefaultAddonFilter.dll” failed

crm internal server error

This is because the Defaultaddonfilter.dll file is a 64bit extension and our 32bit web application is unable to load it. It is trying to be loaded due to the settings being inherited from the main website configuration. To fix this problem we need to make a small change to the applicationhost.config file:

  • Browse to the following path on the server: c:\Windows\System32\inetsrv\config\
  • Open up the applicationhost.config file in an editor and look for the following line (950 on my box):

<filter name=”CRM.Default.Addon” path=”C:\Program Files\Microsoft Dynamics CRM\Server\bin\DefaultAddonFilter.dll” enabled=”true” />

  • Carefully add preCondition=”bitness64″ onto the end of this line. This command tells IIS to only load this module if the application pool is running with 64bits. Your line should now read:

<filter name=”CRM.Default.Addon” path=”C:\Program Files\Microsoft Dynamics CRM\Server\bin\DefaultAddonFilter.dll” enabled=”true” preCondition=”bitness64″ />

  • Save the file back and reload your page

Remove CRM modules

When running your application after completing the above you will probably get the following error:

[NullReferenceException: Object reference not set to an instance of an object.]Microsoft.Crm.Authentication.InternalRequestAddressHelper.GetInternalNetworkAddresses() +108
Microsoft.Crm.Authentication.InternalRequestAddressHelper.IsInternalAddress(IPAddress requestAddress) +82
Microsoft.Crm.ServerLocatorService.IsPathBasedURLsEnabled() +143
Microsoft.Crm.MapOrgEngine.Execute(Object sender, EventArgs e) +44
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +92
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64

crm.authenication error

This is again down to the settings this web application has inherited from its parent, in this case the modules. To sort this error do the following:

  • In the IIS console browse to your web application and open up the “modules” section
  • Look down the list and you should see two entries that are related to Microsoft.CRM (in my case CrmAuthentication & MapOrg
  • Highlight these entries and remove them

IIS7 modules screen

After completing both items above your custom script should now be working correctly

hello world aspx page

Further Troubleshooting

Running asp pages under the CRM site

“HTTP Error 404.3 – Not Found

The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.”

This is because the asp handler is a 64bit application so it wasn’t running under my 32bit web application. To sort this out I simply created a second sub-application this time running under a 64bit web application.

This then generated the following:

“HTTP Error 404.17 – Not Found

The requested content appears to be script and will not be served by the static file handler.”


  • Open the web.config file for this location (in my case c:\inetpub\archive\test) or create one at the root of your application
  • Enter the following lines between the <system.webserver> tags

<add name=”asp” path=”*.asp” verb=”*” modules=”IsapiModule” scriptProcessor=”C:\WINDOWS\system32\inetsrv\asp.dll” resourceType=”Unspecified” requireAccess=”Script” preCondition=”bitness64″ />

This should add-in the correct ASP isapimodule for IIS to run your application.

Incorrect bit level set

“BadImageFormatException: Could not load file or assembly ‘microsoft.crm.sdk’ or one of its dependencies. An attempt was made to load a program with an incorrect format.”

This is caused by the wrong type of application being loaded, e.g 64bit module in a 32bit site or vise-versa.


The above solution worked for the custom applications that I needed to run, there are no guarantees that it will do what you need but I don’t see why with a little bit of trial and error its possible to run any applications you want under the root CRM site. I am a little bit wary that any future patches to CRM will change the applicationhost.config file back to its previous state but hopefully that should be fairly simple to put right again.

If anyone has used the above to help with a CRM issue I would love to hear from you so please drop me a comment using the form below.

[tags]iis 7.0,server 2008, crm 4.0[/tags]

  1. eman43078 says:

    in reference to Calling LoadLibraryEX on ISAPI filter “C:\Program Files\Microsoft Dynamics CRM\Server\bin\DefaultAddonFilter.dll” failed, where do you insert the text: ‘preCondition=”bitness64’ your page shows after line 950 but it does not show what is already in the that line

  2. Hi,
    Sorry the code must have got mangled as I posted this. I have now added back in the correct snippets so you should be able to find it… I’d be interested to know how you get on, and what your trying to achieve with it?

  3. “Enter the following lines between the tags”

    where is the “following lines”

  4. Hi,
    Sorry same thing happened mangled code… need to be more careful in future I think!

  5. Thank you. This solution worked perfectly. God knows how you worked this out, but thanks for posting.

  6. Heh,

    Just wanted to thank you for this.

    My mapping app runs great in standalone a standalone IIS web application, but failed miserably under the ISV folder. After setting it to the “ASP.Net v4.0 (Integrated) App Pool”, I also needed to run:

    %SystemRoot%\system32\inetsrv\appcmd migrate config “Microsoft Dynamics CRM/isv/esri_maps/”

    From the command line. [Change ‘esri_maps’ to your application name.]

    After this, it was still a no go, but I am so grateful as the ASPX steps you describe above now mean I have wonderful maps in my CRM…

    Thanks for taking the trouble to post this.

    All the best,


  7. Greetings I recently finished reading through through your blog along with I’m very impressed. I do have a couple inquiries for you personally however. Do you think you’re thinking about doing a follow-up publishing about this? Will you be likely to keep bringing up-to-date as well?

  8. Josh Vega says:

    After changing the applicationHost.config file, adding the preCondition=”bitness64″ to the filter, I still have the same issue with DefaultAddonFilter.dll.

    It’s as if my change never happened.

  9. What’s Going down i am new to this, I stumbled upon this I have found It absolutely useful and it has helped me out loads. I hope to give a contribution & aid different customers like its aided me. Great job.

Leave a Reply

Your email address will not be published. Required fields are marked *