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

by Ben Lee | Jun 11, 2008 | Fixes | 8 comments

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.

Problem

traffic diagram - blocked second site

Solution

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):

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

  • 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:

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

  • 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.”

image

  • 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

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

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.

Finally

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]

ICYMI Lite, every Monday.

Tagged
Ben Lee

Ben Lee

Ben Lee is a Microsoft MVP and MCT who has been wrangling Microsoft 365 for longer than he would like to admit. By day he is a Head Nerd at N-able. Everything here is his own opinion.

Related

ICYMI Lite: 2–8 November 2026

ICYMI Lite: 2–8 November 2026

🧻 ICYMI Lite: my first agent, let them eat cake 𝗧𝗟;𝗗𝗥: Last week Microsoft called time on SharePoint's .agent files and made Agent Builder the front door for a first agent, started telling unlicensed Copilot Chat users when they've hit a limit (without saying what the...

ICYMI Lite: 26 October–1 November 2026

ICYMI Lite: 26 October–1 November 2026

🧻 ICYMI Lite: one harness, hold on to your hats 𝗧𝗟;𝗗𝗥: Last week Microsoft gave its agent harness one name, took it to Foundry and put a Decision API in front of Work IQ, started winding down Azure Communication Services, and offered 60,000 people the door in the same...

Agent Builder or Copilot Studio? Building agents in Microsoft 365

Agent Builder or Copilot Studio? Building agents in Microsoft 365

Agent Builder or Copilot Studio: where should you actually build an agent in Microsoft 365, and do you even need an agent, or was it a flow all along? In episode fifteen of 365 Explained, Ben and Zach finally deliver the agents episode we promised back in the Power Automate one, from building an agent in Agent Builder to a tour of Copilot Studio and its harnesses.

The Microsoft Authenticator AuthMask flaw: what to check

An interesting write-up this last week on a flaw in Microsoft's Authenticator app. Don't worry (well, not a lot), a fix was pushed in July, and thanks to responsible disclosure we're only now getting the full detail. Enclave's AuthMask research showed that a malicious...

ICYMI Lite: 19–25 October 2026

ICYMI Lite: 19–25 October 2026

🧻 ICYMI Lite: defaults, smoke alarms and PHP 𝗧𝗟;𝗗𝗥: Last week GitHub started switching on Copilot defaults for admins who never picked, Teams put itself into Efficiency Mode on 8 GB laptops, OpenAI's own coding agents turned off the monitoring that watches them and...

Windows Update certificates are rotating in 2027

PSA: if you use Windows Update to patch your machines directly, be aware that Microsoft is rotating out the certificates behind it on 17 May and 19 June 2027. To keep connecting after those dates, your devices need to have installed the September 2025 security update...

ICYMI Lite: 12–18 October 2026

ICYMI Lite: 12–18 October 2026

🧻 ICYMI Lite: plumbing, subpoenas and open source 𝗧𝗟;𝗗𝗥: Last week Microsoft put agent skills behind MCP and told Copilot connectors to sync faster, renamed another round of exams with "Agentic" in the title, the FTC sent subpoenas to OpenAI and Anthropic in the same...

Robots in the therapist's office: IT pro troubleshooting in the age of AI

IT pro troubleshooting in the age of AI

Once upon a time, the IT pro troubleshooting toolkit was things like Regedit, command-line tooling, plumbing the depths of .ini files, watching process traces and capturing network logs. These days, with AI, it feels a bit more like you need to have a good grounding...

ICYMI Lite: 5–11 October 2026

ICYMI Lite: 5–11 October 2026

🧻 ICYMI Lite: Windows goes local, agents go off-piste 𝗧𝗟;𝗗𝗥: Last week Microsoft built Windows around models that run on the laptop and put an Nvidia price tag on the hardware to match, Anthropic's own agents filed a fake murder tip and got their internet taken away...