Could not load file or assembly ‘XXXXX’ or one of its dependencies. An attempt was made to load a program with an incorrect format.

Scenario : 

I have assemblies in my mail solution (.net 4.0) from different versions (32 bit) . I have already set “Any CPU” in my VS 2010 project and everything works fine until i deploy it on IIS . 

Look here how to set your project to “Any CPU”

 

I get “Could not load file or assembly ‘XXXXX’ or one of its dependencies. An attempt was made to load a program with an incorrect format.” error…

 

Fix:

–> Go to IIS manager  admin  window

–> Go to properties of application pool selected for your application

–> Click on default properties of application pool 

–> set “Enable-32 bit applications” to True.

 

Run your application now 🙂

 

 

 

 

Advertisements

Running websites in asp.net 2.0 and 4.0 on same IIS

This sounds like a very difficult task but its really now.

Lets take it a scenario to make it happen .

I have a Widows 2008 server with IIS 6.1 installed on it . I have some applications running on it already which are built on .net2.0 framework.

I want to host new application built in .net 3.5 or 4.0 framework .

Steps

  1. Download the new framework from below link

http://www.microsoft.com/download/en/details.aspx?id=17851

2. install it .

3. Restart computer

4.now register the new framework on IIS server

   image

 

5. Now you will get new framework application pool in your IIS

image

6. Assign this application to your application.

 

That’s it!!

It is an error to use a section registered as allowDefinition=’MachineToApplication’ beyond application level” in asp.net

Today i faced this problem while building my web application .

“It is an error to use a section registered as allowDefinition=’MachineToApplication’ beyond application level” in asp.net”

After trying with some ways and analyzing my folder directory i came to know that i have added one more web.config file to one of  its sub directory.

I removed the additional file and problem was resolved .