Error in asp.net but application run smoothly - c#

I got a error:
Error 1 Cannot copy assembly 'ICSharpCode.SharpZipLib.dll' to file 'FileLocation\bin\ICSharpCode.SharpZipLib.dll'.
Unable to add 'FileLocation\bin\ICSharpCode.SharpZipLib.dll' to the Web site.
Unable to add file 'bin\ICSharpCode.SharpZipLib.dll'.
The process cannot access the file because it is being used by another process.
Any idea about this?

This is an error you can get when you have a file that's still locked by a process; it sounds like the file was still open by something when you went to build,so it couldn't copy it to the website.
As long as you aren't directly modifying the ICSharpCode.SharpZipLib source code, and since it's reporting it to already be in the location you need, it's possible that the development or IIS server just still had the file open, in which case it wouldn't be a big deal. (Did you close all browsers?) If that's the case, and your application is running fine, then it's probably not a huge deal, although I would probably close down the development server, and Visual Studio, then reopen and try again. (If running on IIS, try restarting the website.)
If you start having issues with whatever part of your code uses the Zip functionality, then you will need to investigate further.

Sounds like your app was recompiling and tried to copy the zip lib, which was already in use because of a bad ref in visual studio or a running program. When does this occur? Please provide more details. Close out visual studio (if its running). If its a web app, restart IIS and try doing whatever unknown action you were doing again.

Application tried to copied ICSharpCode.SharpZipLib.dll file from GAC or Visual Studio Assembly folder into your application's bin folder but it can't copied and application runs successfully on your system because your application put this dll file from GAC. But whenever you will run this application any another system on which Visual Studio not installed, on that machine it couldn't runs properly....

Related

The file or directory is corrupted and unreadable on .exe files created from VS

So, all the .exe files that I am creating from Microsoft Visual Studio keep on throwing an error message The file or directory is corrupted and unreadable when I want to run them. This is only happening in a specific Windows 10 machine. The same is not happening on other Windows 10 machines. I have tried to recreate the .exe both from VS 2017 and VS2019. I have also tried to create WPF, Win Forms and Console Apps. The issue remains, as long it is a .exe created from VS. Other .exe files, for example, .exe downloaded from the internet or the ones in the Program Files are running perfectly fine. I read about running the scs \scannow and still, the issue persists.
Anyone who may be faced this before and how you solved it?
This error is often a sign of disk/file system defects.
I'd try to move the compiled files out of this folder into
another folder, preferably on another (physical) drive. Then check
if it runs there.
If option 1 does not work you could then try to re-build the files into another folder, also on another (physical) drive preferably.
If one of both of the above solutions works, thats an indication you indeed might have FS/HDD trouble. Try running chkdsk /f c: on the offending drive to check for errors.
If this also does not work, try re-installing Visual Studio.
So, all the .exe files that I am creating from Microsoft Visual Studio keep on throwing an error message The file or directory is corrupted and unreadable when I want to run them. This is only happening in a specific Windows 10 machine.
As the problem only happens with one machine, it seems clear that something is broken on that machine. Either with the OS (unlikely), the IDE or Compiler Installation, or at least that speicific folder.
Edit: As the behavior follows the file around, we can asume it is not the OS. Only something with the build process.
You could try by removing that folder, then making a clean reinstall of the IDE and Framework. But the reliable solution would be to just reinstall that computer from the Filesystem upwards. This is the kind of bug you can spend days trying to debug and still not get anywhere. And even if you could fix it, could you realy rely on the computer to not have other criticial bugs? Maybe ones that do not show a helpfull error message?
As you already verified it happens on no other machines and it persits for any .exe created on this machine, it would at best be trivia to figure out what precisely is wrong. I can give you a rough idea:
Some file got binary damage while in ram or on disk. Either that file was the compiler, or a file that then went on the corrupt the compiler, or a file that corrupted the file that would end up corrupting the compiler. As we are not dealing with the kind of hardware that has to run a mars rover, guided missile system or nuclear power plant, those things happen.
The reason why I was experiencing the stated issue is because of the data transfer methods (Teamviewer, AnyDesk and Microsoft Remote Desktop) I was using to move files between the two computers.
I discovered that the issue was not only about .exe files. Any file I copied across to this specific Windows 10 machine that was giving an issue, I could not open it. It could throw the same error message. In this case, I accept that this an OS issue. However, I was not prepared to reinstall the machine.
So, to resolve the issue, I did use FTP to move the files between the two computers. I uploaded the .exe file to FTP Server from the one computer and downloaded the .exe on the other computer that was giving issues. Downloaded files could then open without any issues.

C# exe not working once installed to program files folder via Wix

I have a C# winforms application which will not work once installed to the C:/ProgramFiles folder. I use an MSI created with Wix to install. When either double clicking the exe or right clicking and running as admin this window pops up and then nothing happens:
Application Error Message:
The application works in Visual Studio and when accessed via the bin/Debug folder of my VS project (the exe in the Debug folder is the one I am using for the Wix install).
After the MSI installs, if I copy the exe out of
C:/ProgramFiles to one of my user folders (ex: C:/Users/User/Desktop) the exe works.
I am guessing this is some sort of UAC/permissions issue but I cannot find any documentation to confirm that theory. Any direction would be much appreciated.
EDIT:
Looking at the error log it is denying me access to my config file. Here is the error text:
Access to the path 'C:\Users\*username*\AppData\Roaming\Leer Copy\leerConfig.xml' is denied.
EDIT II:
This problem is getting more confusing (and frustrating). It will allow me to write to the AppData folder but not read from it (shouldn't it technically behave the other way around?)... Would really appreciate some help. I am reading the contents of my XML file via XDocument.
Originally had hid the config file so people do not mess with it/accidentally delete it. Making the file not hidden fixed the access denial and everything works how it should now.

Why is my C# web project looking for a local file once it is uploaded to remote server (with code behind)? [duplicate]

I am using C#.net for application development.
To log and debug exceptions, I use the stacktrace.
I executed my application on another machine, but when errors occur it refers to the path of my development machine.
Ex: D:\Projects\xyz.CS line no :12 _Error_message_here.
Why does it trace to the path on my development machine path even though I am running the application on another machine?
The original compiled path is stored in the debug information within the PDB files.
Because it's telling you where to find the problem in your source code. So when you see this, you can go to your machine and open the file reported (e.g. "D:\Projects\xyz.cs"), go to the reported line (e.g. 12) and fix the problem.
Explanation
When you do a Debug build, it includes source information in the compiled files to enable debugging, e.g. pause, step over, etc.
Solution
If you don't want the source information to be included perform a Release build and deploy that to the other machine.

C# Application publishing issues

I have just created a Windows 7 Desktop Application that allows you to essentially record your screen. I have included all the resources. I am treating it like a "load from CD" type app, as it requires some files as resources. When executing the files to the folder I have made on my desktop, I obviously get the Application files folder, with the manifest and DEPLOY files in; along with the ClickOnce.exe launcher. I then also get the DVD/CD setup.exe file and another clickonce app.
Which installer should I use? And why am I getting these errors? See Below:
When clicking the setup.exe, I receive this error: http://pastebin.com/kgXSnMJY
When Clicking the Clickonce app I get a similar error: http://pastebin.com/1CCT1CKx
What could my issue be?
I managed to avert this, by compiling the files like a "release" inside of a debug. The issue was with the resources I was using, the .dll's did not seem to download correctly (at least I don't think so). Thanks for all the advice and help :)

Unauthorized Access Exception writing file from .exe

My WPF application writes an XML file to a folder within the CommonApplicationData folder on a Windows 7/64 machine. This works fine from Visual Studio 2010. When running from the .EXE file, I get a System.UnauthorizedAccessException when writing the file.
Is this a problem with my initial setup of the folder? Or is this related to the permissions of the executable file itself? Not quite sure how to handle this one??
Paul
I think that it is a problem with permissions to the folder.
Probably Visual Studio runs your application as an administrator and the .EXE file is executed as a normal user.
Perhaps you want to re-evaluate storing that data (XML) in that location all the time. Limited users won't be able to write to it. Sure, you can force admin privs but your users may not always have that option (and it's kinda a hack anyway).
The question below seems to outline a work-around depending on the user's priv level.
writing files to Common Application Data folder denied
Right click on the *.exe file and "Run as administrator".

Categories