I have an application that loads user controls into .NET web application. When I compile and test the application locally on my dev machine it works on my machine. The project builds successfully using MSBuild on our build server. However when I deploy the dll generated by MSBuild on the build server I get the following error when the application loads the control:
BC30456: 'CreateResourceBasedLiteralControl' is not a member of 'ASP.usercontrols_somecontrol_ascx'.
I took a look and compared the dll generated on my machine and compared it(looked at the file size) with the one created by the build server and noticed
a difference in the file size. This is confusing considering the code being built locally and on the build server is IDENTICAL. I manually compared each file by hand. So my question is: What is causing this error? What would be different between MSBuild's compilation of the code and what is going on in Visual Studio when compiling the code?
You've got a versioning issue. Some assemblies are different on your target machine than on your dev machine. I'm afraid you're going to have to do some digging to hunt it down, since this error message is entirely unhelpful. Really it's pointing you in the wrong direction since the problem isn't in your assembly. It's probably caused by something in your project References. Have you got some 3rd party tool or SDK on your dev machine that hasn't been updated on the server yet?
The last time I saw this was when I had built a DotNetNuke module that was built against a newer DotNetNuke.dll assembly than my server had.
If you compile that as dll.
Try delete App_Code.dll in bin folder.
Related
I am creating an ASP .Net Core (2.0) MVC application within Visual Studio 2017 which was working absolutely fine.
After turning off my computer yesterday and coming back to my application today, I now receive this browser error when I start the application in chrome without debugging.
Running dotnet run within the directory of the application, I can access the site just fine. It is just when I run it via Visual Studio/IIS Express I get this error.
HTTP Error 502.5 - Process Failure
The application builds and compiles just fine. I have also cleaned the solution.
Looking in the event logs I find:
Application 'MACHINE/WEBROOT/APPHOST/MYAPP' with
physical root 'C:\Users\Ben Hawkins\Desktop\Development Folder
\Dev\Website\Version_2\MYAPP\MYAPP\'
failed to start process with commandline 'C:\Program Files
(x86)\Microsoft Visual
Studio\2017\Community\Common7\IDE\Extensions\Microsoft\Web
Tools\ProjectSystem\VSIISExeLauncher.exe -argFile "C:\Users\Ben
Hawkins\AppData\Local\Temp\tmp3547.tmp"', ErrorCode = '0x80004005 :
0.
Within my output window in Visual Studio 2017 I recieve this message under
ASP NET CORE WebServer
Failed to initialize CoreCLR, HRESULT: 0x80131534
What I have tried:
Cleaning the solution, rebuilding etc
Restarting the computer
Trying to launch another application. (Same result)
Created a new application from scratch. Same result.
Repairing Visual Studio Community 2017. Same result.
Stopping/Closing IIS Express
My setup was working perfectly yesterday and suddenly is not.
Thank you for your time. I hope we can find a solution.
We finally found the issue! After logging on to the machine as a different user, we saw a warning that the main user had ignored initially. There was a 0 byte file in the root of the directory named "Program" with no file extension. It appears that this causes some sort of issue when VSIISExeLauncher.exe is invoked through Visual Studio. (Note it would work if executed from the command prompt). After deleting the file, everything worked!
We do not know how this file was placed there for certain, but suspect it was some sort of copy error when the user was pulling in files from his old hard drive.
I don't know if anyone else will come across this, but if so hopefully this helps!
Maybe you need install previous versions of .NET Core, isn't it? I installed here and it works now. I had only .NET Core 2.0 installed and I realized that applications with 1.1 stopped so when running. In Windows' event logs I've had the same error registered.
Try to change the IISExpress to IIS by creating new IIS profile and change the Lunch to IIS. It resolved my problem.
I have hit a very similar issue with ASP.net Core 2.0. I had copied my VS project to a new one, and I was getting this error message.
After doing some research, I was able to determine that the nlog.config file was not copied into the bin > Debug > net461 folder. Once I did this, I was able to run my application.
I found it by running dotnet run from the command line on my project where the csproj files live.
Had same issue yesterday (windows 10).
Solved it this way:
Update Microsoft.AspNetCore to latest (Nuget manager - 2.1.3)
Make sure the sdk also updated to latest version. if not, update it manually from Nuget console like this:
Install-Package Microsoft.NETCore.App -Version 2.1.3
Download and install latest ASP.NET Core/.NET Core: Runtime & Hosting Bundle
from here
Same problem with version 2.2. Reinstalling .NET Core SDK fixed the problem for us.
In my case, my project was setup as a website in IIS and the file "bin\IISSupport\VSIISExeLauncher.exe" was missing in the project's directory.
I simply selected "IIS" when debugging the project in Visual Studio 2019 and it generated the missing file. It also generated 2 text files (IISExeLauncherArgs.txt, pidfile.txt) in the IISSupport folder, made changes to my web.config file, and my project ran successfully.
After that I was able to access the local website that was setup in IIS without running it in Visual Studio.
So here's the thing. I recently updated a web project to use nuget for its dependencies, which in turn updated all of those dependencies to the latest versions.
Quite a task as there were some breaking changes, but I have the thing running locally perfectly.
We use TeamCity to pull the solution from bitbucket and deploy it the the local iis folder on a development (staging) server.
After a build, the website seems very poorly, first off it complains:
Could not load file or assembly
'file:///C:\web\Dev.Pegfect.Presentation\bin\mscorlib.dll' or one of
its dependencies. An attempt was made to load a program with an
incorrect format.
Which is strange since my local copy does not have a copy of mscorlib in its web bin folder. Should be using the GAC? If I remove the dll, I get a new error (some NHibernate issue complaining about reflection). I haven't pursued that since it all seems environmental.
If I copy my local bin folder over the server web bin, it starts to run ok albeit extremely slowly (relative to how it used to).
So, the question "what have you tried" - i am currently installing VS 2012 onto the server and will try building the project from source directly. I am also considering updating TeamCity from v7 to v9.
I could also try to reinstall IIS8.0 on the server.
These are desperate, blind shots in the dark. What would you try?
FWIW the project is targeting .NET 4.5.1 (ANY CPU)
OK, so I will leave it here as it might help someone.
So, the project has been building, deploying and running successfully on the server compiled to .NET 4.5.1 with no problem.
The recent packages update moved us from MVC v4 to MVC v5. (amongst other things). Running .NET fix tool suggested 4.5.1 was corrupted, so I downloaded the developer version and installed and now its fine.
I encountered a problem.
Now, I'm using Visual Studio 2010 to create a web site project (It's not web app.), I need to add a .dll file built under 64 bit platform by visual studio to this project, when I tried to build this project, I occurred an error says:
Could not load file or assembly 'XXXXXX' or one of its dependencies. An attempt was made to load a program with an incorrect format.
I tried many methods to solve this error, but they all don't work ?
I'm working with this dll at the moment on local host with VS 2008, to get the dll to work I had to place it in C:\Windows\system and it runs fine. But I am worried about transferring it to my web server, though I'll cross that bridge once I've got the app working. Hope this helps
Background
I am utilizing the following:
VS 2012
.NET 4.5 apps including an MVC4 app, a C# Domain app, and NUnit projects.
A custom MSBuild File
CruiseControl.NET running on a build server
I have the following build targets:
Clean: deletes the buildartifacts directory
Init: creates a blank buildartifacts directory
Compile: compiles the solution
Test: runs NUnit Tests
Package: creates a ZIP package for deployment
Deploy: Deploys package to a remote IIS Server
Problem
When I run the build from my local machine, it packages and deploys perfectly.
When CCNet runs the same build target, the files appear to be deployed
Attempted Resolutions / Potential Leads
I have run the same target in PowerShell from both machines and have seen no errors or warnings on either.
Because I tell CCNEt to override the framework to point it to the .NET 4.5 files I've copied to the build server, I made my local machine point to the same files when running MSBuild but my local build still worked and deployed.
In Visual Studio, I have ensured that all content files are marked with a Build Action of "Content" and a Copy to Output setting of "Copy Always".
The Code
Available in a gist at https://gist.github.com/53ef2a63931d190593f6
(file has been scrubbed, app name & credentials replaced, etc.)
It turns out, this was a completely unrelated issue.
After doing a diff of both build logs, I noticed that the build server working copy contained old files that no longer existed. This led me to discover that the issue ended up being that the repository wasn't being updated.
CCNet was receiving a subversion error that wasn't registering as an error
As a result, I was never getting the latest version of the repository, and so all files were broken.
The error is related to this StackOverflow question, regarding a sqlite error when attempt to use tortoisesvn to update. The solution in my case was to simply delete the build server's working copy, recreate the folder, and perform an svn checkout.
I'm having a problem when browsing a published site on local iis7 (on windows 7).
When browsing the asp.net site through VS2008 with F5 (dev iis) it works fine. When publishing it and browsing, I get a:
Server Error in '/MySite' Application.
The specified module could not be found. (Exception from HRESULT: 0x8007007E)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.IO.FileNotFoundException: The specified module could not be found. (Exception from HRESULT: 0x8007007E)
Stack trace offers no clue on the problematic dll either. I copied the same published folder to a different machine (also with windows 7 32bit and iis 7) and it works.
Since this is a fresh install of iis on my machine, I verified the matching selected items in "Turn Windows Features on/off". After noticing the issue I also ran the "aspnet_regiis" util, but the problem remains.
The web site includes several external dlls (native and managed) and they all appear in the published bin folder (which is identical to the development bin folder)
Any insights?
Cheers,
Shay
As gleaned from this thread: http://social.msdn.microsoft.com/forums/en-US/netfx64bit/thread/f609f52e-00f6-4ada-9d6e-7129b85d3d4d/, as mentioned toward the bottom of the thread (second to last post as of right now), our problem was a "rogue" dll, Microsoft.SqlServer.Replication.dll. We simply removed the dll and no more error. Additionally, as no project in the solution referenced this dll, I simply removed it from the bin file and subsequent builds/publishes do not add the dll. I have no idea how the dll got in the bin file in the first place. A college prank, maybe.
Native dlls are supposed to be locatable in the PATH. Problem was they were under the User PATH and not the System PATH, so it worked fine through the VS but not through the IIS. I added the dll folder to the system PATH and everything worked...
A long shot in most cases but check you have good .NET Framework libraries. Was getting nothing from old Framework 2.0 website maintained with VS 2005 running on IIS 6 except plain text in browser window stating the error. Fiddler and Firebug reveled nothing. Started checking this, that and the other thing. Perhaps when wondering about using aspnet_iisreg that the C:\Windows\Microsoft.NET\Framework\v4.0.30319 folder was discovered to have only a handful of files. Doesn't make a lot of sense, the applications were 2.0 but there is some cross application communication and several libraries so maybe some are run as 4.0 or it might be that IIS will try to use some things from the highest version of .NET Framework available.
A co-worker more knowledgeable about servers repaired the 4.0 Framework with the stand alone installer from here.
Runs well now.
This error occurred for me when the .Net Framework on the target server was only 4.5.2 and a recently upgraded Nuget package required 4.7.2. To temporarily solve it, we downgraded the Nuget library to a previous version that did not require 4.7.2 until we can upgrade the server library.
This was in spite of our project properties having .NET Framework 4.5.2 selected as a target framework.