I am using visual studio 2010 and have installed mvc 4. When debugging using the vs development server the sample web application works perfectly but if i try to debug with IIS i get the following error:
Could not load file or assembly
'Microsoft.VisualStudio.QualityTools.HostAdapters.ASPNETAdapter,
Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or
one of its dependencies. The system cannot find the file specified.
I do not have any references to quality tools in web.config, have tried to add them but still did not work. I also tried o use the aspnet_regiis tool just in case.
i have also tried to target different x64 or x86 platform but it did not make a difference.
My dev machine is windows 7 64 bit
You can find an answer here
This error is caused by mixed development environment. That means you
have build the service with .NET 4 at he x64 machine and somebody else
is trying to host the service at his x86 development machine
If it doesn't work, check that the target framework is 4.0
Related
I get the "Could not load file or assembly xxx or one of its dependencies*********" error when I host my website on a Windows Server 2012 (IIS 8). The xxx here is my project name in my local VS 2015. The application is working perfectly fine in my local PC
It is a VB.NET application with Oracle 12c database as it's backend.
Things I have tried till now.
1. Publish with setting the Target CPU as "Any CPU" and Configuration as "Release-Any CPU" - Still the same error.
2. In the Server IIS, I have set the Enable 32-but apps as True on App's App pool. This is giving a different error. - Could not load file or assembly 'Oracle.DataAccess' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Please help.
It sounds like your Oracle.DataAccess dll is a 64 bit dll. You can see what driver is loaded on the web server by navigating in Windows Explorer to the \windows\assembly folder.
Most applications that are built with the Any CPU option will have the checkbox in the project settings to prefer 32 bit. To avoid this, change your project's platform target to be a 64 bit.
Then you do not need to "Enable 32 bit" in your application pool and your problem should disappear. Please let me know if this helps.
My Tools: Visual Studio 2010, Crystal Reports 13, MVC3 APP, Windows Azure
When I publish my MVC app in Windows Azure, i get the error: Could not load file or assembly 'log4net' or one of its dependencies. An attempt was made to load a program with an incorrect format.
My SO is 64 bits and server run in 32. I try change my app to deploy on ANY CPU and 32 BITS but does not effect. The assembly that i call is:
<add assembly="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304" />
If i remove the assemble and compile, local works fine. But if publish I get the error. Looking in GAC i found two log4net, one in AMD64 and other in 32 Bits. Probably removing the reference on web.config then works local because the .net framework finds in GAC every register that is refered, but then Azure obviously not work.
How publish my 64 bits app in Windows Azure with log4net right to generate the crystal reports?
To fix this erro is necessary check 3 points:
1° How i said in my question, processor (AMD64 or x86) is one of fonts of the erro. Some articles say about change the deploy mode from ANY to x86. This not fix this error, and generate others bugs depending of situation. Dont do this.
2° This LINK show how change the log4net for work. In some cases this can fix the problem.
3° If your processor is correct with version of log4net and the bug persists, install in your server the Crystal Reports CR again, in my case works, perhaps the instalation fix some other bugs in bin folder. In my case, i need to install Azure Cloud app.
I am building ASP.NET application with C# and I want to connect to oracle database.
I have added reference to Oracle.DataAccess in my application on my 64bit Microsoft Window Server 2008 machine.
I also installed ODAC (Oracle Data Access Component) on my machine
and Oracle.DataAccess.dll is also present on this path
C:\Windows\Microsoft.NET\assembly\GAC_64\Oracle.DataAccess
but when i'm trying to connect i encounter following error:
Could not load file or assembly 'Oracle.DataAccess, Version=4.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. The system cannot find the file specified.
As far as I know, the Oracle.DataAccess assembly works only with 32 bits, I also have this kind of problem with 64 bits and it really does not work. My solution was remove the 64bits from GAC and install the 32 bits on GAC. I also remove any .dll file in the bin folder to my application find the assembly on GAC.
There is no problem if your machine and operational system is 64bits, the 32bits version will work fine.
UPDATE
I recommend you take a look at Official Oracle ODP.NET, Managed Driver, that is a better version than Oracle.DataAccess. This Managed Driver does not need the Oracle Client on the machine, and you just need to provide the TNS on the DataSource field of the connection string and it works fine for 32 and 64 bits.
You need to install both x64 and x86 versions of Oracle, because something (I think it was Visual Studio) uses the x86 version when debugging.
In VS2010, I changed the platform target to x64 and this error message disappear.
essentially same error
missing ODP.NET installation components as per last post from me and the other answer participant.
You check the GAC yet?
If you do not see Oracle.xxx folders,
you are not making any headway.
put the correct version and bit of Oracle.DataAccess.dll into the application /BIN folder and make local reference. It solves many problems.
To run your website, you must use IIS since visual studio's development server only runs in 32 bit mode.
In IIS application pool, set your application to run in 64 bit. (The setting is in advanced settings)
To resolve this error, I set my app pool in IIS to allow 32bit applications.
Open up IIS Manager, right click on the app pool, and select Advanced Settings --> set “Enable 32-bit Applications” to True. It's working fine for me.
I got the same exception on a c# console app. What solved it for me is to change the platform target to x86. (project properties => build )
My machine:
Windows XP (x86), VS2008, .net 3.5, sql server 2005, WinForms -> App works fine.
Production Machines: Windows 7 (x64), SQl Server 2005 Express -> App Starts but throws exception
Visual Studio Targeting x86 on setup project and RMO project. Visual Studio gives me a a couple warnings but I can still build:
Unable to find dependency 'MICROSOFT.SQLSERVER.MANAGEMENT.SQLPARSER' (Signature='89845DCD8080CC91' Version='10.0.0.0') of assembly 'Microsoft.SqlServer.Smo.dll'
Unable to find dependency 'MICROSOFT.SQLSERVER.MANAGEMENT.SQLPARSER' (Signature='89845DCD8080CC91' Version='10.0.0.0') of assembly 'Microsoft.SqlServer.Management.SmoMetadataProvider.dll'
This is a simple RMO (Replication Management Objects) app that initiates a pull subscription in SQL Server 2005 and displays status. Works fine on my machine, but fails on the production machine. I'm using a setup project to install the app on the production machine, but I think I'm missing a dependency somewhere, but I can't figure it out.
On the production machine the app starts fine, but when I try to synch the subscription i get:
System.IO.FileNotFoundException: The Specified module could not be found. (Exception from HResult: 0x8007007E)
EDIT: Task Manager in Win 7 inditcates that it is running as a 32-bit app (myapp.exe *32).
EDIT: Ok, my app is now showing in task manager that it is a 64 bit app, but I'm getting an error. I'm thinking that I some how have a dependency dll targeting x86. How can I verify the dependency dll is targeting the correct platfrom and/or make sure that it is targeting x64... I thought the setup prjoect would rebuild the dll in my detected dependencies to target whatever cpu I chose in the setup project?
Could not load file or assembly 'Microsoft.SqlServer.Replication, Version=10.0.0.0, Culture-neutral, PublicKey Token=89845dcd8080cc91' or one of its dependencies. An attempt to was made to load a program with an incorrect format.
run Fusion Log viewer as administrator and set it to Log Bind Failures to Disk.
that way you'll be able to see which DLL's don't load properly.
I thought the setup prjoect would rebuild the dll in my detected dependencies to target whatever >cpu I chose in the setup project
the setup does not compile any dlls for you automatically.
An attempt to was made to load a program with an incorrect format.
look here, on where to find an x64 version of 'Microsoft.SqlServer.Replication'
http://social.msdn.microsoft.com/Forums/en/sqlreplication/thread/628ec2ae-c5d1-4aef-b31b-b889975bfc2b
The exact error is as follows
Could not load file or assembly 'Microsoft.SqlServer.Replication,
Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91'
or one of its dependencies. An attempt was made to load a program with
an incorrect format.
I've recently started working on this project again after a two month move to another project. It worked perfectly before, and I've double checked all the references.
The answer by baldy below is correct, but you may also need to enable 32-bit applications in your AppPool.
Source: http://www.alexjamesbrown.com/uncategorized/could-not-load-file-or-assembly-chilkatdotnet2-or-one-of-its-dependencies-an-attempt-was-made-to-load-a-program-with-an-incorrect-format/
Whilst setting up an application to run on my local machine (running Vista 64bit) I encountered this error:
Could not load file or assembly ChilkatDotNet2 or one of its
dependencies. An attempt was made to load a program with an incorrect
format.
Obviously, the application uses ChilKat components, but it would seem that the version we are using, is only the 32bit version.
To resolve this error, I set my app pool in IIS to allow 32bit applications.
Open up IIS Manager, right click on the app pool, and select Advanced Settings (See below)
Then set "Enable 32-bit Applications" to True.
All done!
I've found the solution. I've recently upgraded my machine to Windows 2008 Server 64-bit. The SqlServer.Replication namespace was written for 32-bit platforms. All I needed to do to get it running again was to set the Target Platform in the Project Build Properties to X86.
Change the value for Platform Target on your web project's property page to Any CPU.
Go to IIS
-> Application Pool -> Advance Settings -> Enable 32-bit Applications
We recently had the issue when trying to run the code from Visual Studio. In that case you need to do
TOOLS > OPTIONS > Projects and Solutions > WEB PROJECTS and check the "Use the 64 bit version of IIS Express for web sites and projects".
For those who get this error in an ASP.NET MVC 3 project, within Visual Studio itself:
In an ASP.NET MVC 3 app I'm working on, I tried adding a reference to Microsoft.SqlServer.BatchParser to a project to resolve a problem where it was missing on a deployment server. (Our app uses SMO; the correct fix was to install SQL Server Native Client and a couple other things on the deployment server.)
Even after I removed the reference to BatchParser, I kept getting the "An attempt was made..." error, referencing the BatchParser DLL, on every ASP.NET MVC 3 page I opened, and that error was followed by dozens of page parsing errors.
If this happens to you, do a file search and see if the DLL is still in one of your project's \bin folders. Even if you do a rebuild, Visual Studio doesn't necessarily clear out everything in all your \bin folders. When I deleted the DLL from the bin and built again, the error went away.
I had this in an MVC5 app in Windows 10 against IIS Express. My solution was the following:
Tools =>
Options =>
Projects and Solutions =>
Web Projects =>
Use the 64 bit version of IIS Express for web sites and projects
change it to 32-bit (true) it works
if you get this Length cannot be less than zero. Parameter name: length issue in iis server configuation do the simple thing change the connection string in web.config file like your sql server name and server name and restart iis then try to load the page it works
If Publishing in Visual Studio 2012 when erroring try unchecking the "Procompile during publishing" option in the Publish wizard.
in windows form application I do this,
Right-click on Project->Properties->Build->Check Prefer 32-bit checkbox.
Thanks all
Delete the temp test directory located here
C:\Users(User)\AppData\Local\Temp\VisualStudioTestExplorerExtensions\
Set all projects to x64 in Visual Studio
Set the default processor architecture to x64(Test/TestSettings/Default Processor Architecture).
Make sure to clean build the solution file.Hope this helps!
Changing the Target Framework in project properties from .NET Framework 4.7.1 to 4.6.2 worked for me.