C# renamed class reference issue - c#

We have ASP.NET MVC application which is running on windows server machine. I have renamed classes to satisfy sonar scanning. The code deploys and runs without issue locally and in our SIT server. However, it is showing error in UAT server on windows server machine. It shows warning in event viewer that it could not find reference to previously renamed class. I have renamed a class from "CarDTO" to "CarDto", it is still trying to look for CarDTO which does not exists after the rename.
I have tried to do the following but none seems to solve the issue.
Restart IIS
Recycle application pools
Clear asp.net temporary folder
Increase the version in assembly info
I used the same files and dll in both SIT and UAT servers.
Anyone has similar issue and a way to solve this? Thank you.

Thanks for the suggestions. Apparently, there is an extra dll that accidentally being copied to the bin folder. Even though it is not being used, it gets compiled by IIS and complaining that class name mismatched.

Related

Running external libraries with R.net in IIS

We're trying to run R.net from an ASP.Net webpage in IIS, but encounter the problem that the R engine can't access external libraries. I know this is a common problem, but the typical solutions haven't worked when it comes to IIS (only IIS express from inside VS).
For example, when trying to use 'colorRampPalette' in R which relies on a DLL, the following error message appears:
"Error in inDL(x, as.logical(local), as.logical(now), ...) : unable to load shared object 'C:/Program Files/R/R-3.4.2/library/stats/libs/x64/stats.dll': LoadLibrary failure: The specified module could not be found."
It is not the stats.dll that is the problem, but rather another DLL it references.
Now, using the function in R works fine. Using the function from R.net in VS debugging works fine. However, running it from IIS does not work. Normally, it's just a path variable missing to get it to work, but this doesn't seem to be the case here.
What we've tried:
Ensured that the PATH variable has the necessary folders (i.e. C:\Program Files\R\R-3.4.3\bin\x64 etc). If this was wrong then R.net wouldn't work locally, and I've also verified that IIS doesn't reset the PATH variables which has been pointed out in other sources. When I check the PATH variable from inside IIS the necessary folders are listed.
Checked that the library, home and bin path in R.net is correct when running under IIS.
Ensured that the IIS_IUSRS user has read/write access to the necessary folders and files.
Verified that the R code is correct.
It seems that this is a common problem, but most solutions refer to making sure the PATH variable is correct, which simply isn't enough in this case.
We're running (Amazon web service):
Windows Server 2016 x64,
IIS 10,
R.NET 1.7,
C# 4.5.2,
R 3.4.2
I've also tried on another (non-AWS) server with a similar setup.
Any ideas of what can cause this? Since a lot of people have issues with R.Net and IIS I suspect someone encountered the same problem where the PATH variable wasn't enough?
As mentioned by user2967150, It is not the stats.dll that is the problem, but rather another DLL it references.
After doing lot of research I found that It try to find Rlapack.dll in 'C:/Program Files/R/R-3.4.2/library/stats/libs/x64/ path.
so you just have to copy Rlapack.dll from 'C:\Program Files\R\R-3.4.4\bin\x64 \Rlapack.dll'
to 'C:/Program Files/R/R-3.4.2/library/stats/libs/x64/ .
After this the web Application can access external R libraries.
Note: I assume that your web Application Run locally but creates a problem when you try to run it on IIS.
I was solving same issue. For IIS I did not find the solution. I was also debugging the R.NET code, but solution by setting correct path to R folder did not work.
The solution is created additional layer, which cover running R project (actually create own R server). I used self hosted WCF service,
https://learn.microsoft.com/en-us/dotnet/framework/wcf/feature-details/how-to-host-a-wcf-service-in-a-managed-windows-service
which is practically console application and has benefits application running not in IIS application pool. This solution also cover singleton REngine problem. In case you run the instance or REngine in IIS, there is no posibility dispose it, only by stop application pool. For self-hosted service you can set trigger for restarting application in case memory leak.
During this implementation I discover problem run R.NET again R 3.4.3 in debug mode on console application I get error "The library "..." could not be load", so I used the R 3.4.2. which work nice. 86x installation is required - independent the your application run in 64x/ANYCPU environment.
Have you found any other solution for that?

IIS 7.5 error on a DLLImport call

I have an error running a asmx WebService that uses asp.net 2.0 on IIS 7.5. The webservice calls a method from a dll using the Dllimport call. The point where the call is made is where the error happens. However I get no exceptions, just ERR_CONNECTIO_RESET from any explorer.
What i've tried:
The dll is located in the right place, the bin folder. I tried moving
it to system32 and other locations. However if I change the name of
the dll on the DLLIMPORT call i do get an error of not locating the
dll, which means it does finds the dll, just crashes on the method.
I also used GetLastWin32Error() and got the message 127
ERROR_PROC_NOT_FOUND. Not sure if it's relevant, however is something
I tried too.
If I run the Webservice on debug from VisualStudio, I get no error on
the call. So the error is when running on IIS.
I also tried on a older machine with IIS 6 on Windows XP and I get no
error. This make me think it has to do with a security issue, because
when I created the website on IIS I got this screen:
IIS 6
And i haven't configurated any security options on IIS 7.5. So i tried this
http://forums.iis.net/post/2119656.aspx
Which are steps to configure the user with enough permissions over the folder. However, still no luck.
What i believe now could be, is something asociated to GOP (Group Policy Object). The pc I'm running this service is on a company network. I have admin rights and no firewall restrictions, however I don't know if IIS 7.5 uses something from a different user or needs different permissions.
All the other threads i've found don't have the right answer for me. Any help i could get is appreciated.
Finally after a week of dealing with this, I found the problem. After finding out there are some Logs I could check on C:\Windows\System32\LogFiles\HTTPERR i found the error code Connection_Abandoned_By_ReqQueue.
After some long investigation, I found out that the message means the program is droping because of memorry corruption (As seen on this post Connection_Abandoned_By_ReqQueue Problems ). The dll I'm using is quite old and the people who generated didn't make a version who handles memory the correct way (At least for IIS 7.5), so I'm stuck with finding another library to do that work, or using a server with IIS 6.

All DLLS in site fail to load, exception 0x80070057

My C# web application stopped working for no apparent reason, while a similar application on the same server still works. Looking for ideas what could be going on and how to fix it.
Yesterday I launched a build of the site with some minor updates. The server apparently went down during the build, because for a few minutes TeamCity displayed a message indicating the connection had been lost. However, it recovered and resumed the build.
After the build, I was no longer able to load the site. The home page now seems to be the only page that can load, and it displays incorrectly because the scripts and stylesheets fail to load. If I check the browser’s error console I find reports of multiple server error 500’s, where the referenced css and script files are failing to load.
The server is IIS on Windows Server 2008.
If I go to the server and open the site there, the page gives me error messages saying, “Could not load file or assembly ‘Antlr3.Runtime.Debug’ or one of its dependencies. The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG)).”
Initially it was reporting the same message for a different file, AntiXssLibrary. I removed that DLL from the project, and the site switched to complaining about antlr instead. It looks like the problem isn’t either DLL, but something else.
On my machine, a nearly identical copy of the same code works without problem. Another copy of the site on the same server, a slightly earlier version of our software, works just fine.
I deleted all of the temp files recommended for this error, redid the build, restarted the machine, and deleted the bin directory and repeated the build. I’m skeptical that uninstalling or reinstalling any versions of the .net framework would help, given that the other site works—any problem with the frameowkr ought to affect both of them.
I turned on assembly logging, which gave me lots of additional information that didn’t help at all.
Any suggestions what could be going on?
Edit: a link below suggests that the problem is corrupted temp DLLs, and that deleting and recompiling will replace them with good copies. That's plausible. But it seems like re-running the build ought to recompile if anything is going to.
Might there be some other way to force it to recompile / update the DLLs?

Web reference not found when distributing application

My question is, when an application uses a web reference is one supposed to hand out something extra along with the .exe file?
I have made an application that uses a web reference for dotMailer API (it's for email campaign management).
The application compiles and runs fine on my PC. But tested it on another machine and kept crashing. After loads of troubleshooting I found this is due to calls using the dotMailer API.
I discovered that Fusion logger is the right tool to show me the reason for failing, downloaded and installed it on the test machine and viewed the logs. Some say the operation was successful while others say it failed even though the assembly download was successful. The test machine has web connectivity. I am just starring at the screen frozen don't know how to tackle this.
Is one supposed to copy something from the Visual Studio project folder over to the test machine for a web reference to work?
I am using Visual Studio 2010
Go to your Project -- > Reference --> Right Click on dotMailer (Your Reference) --> Go to Properties --> Set Copy Local property value as True. Like Below
While distribution of project, we should set the references "Copy local Property as True". Then only the referred Dll's will be copied to publish bin folders.
Reference is here
Related Question / Thread is here

Unexpected Error creating debug information file GG.PDB"--"

When I try to build my project, it returns the following error:
Error 1 Unexpected error creating debug information file 'D:\Documents\Lance\Documents\School\Capstone\GG\GG\obj\Debug\GG.PDB' -- '' GG
I've recently had the misfortune of having my PC restart on me, due to sudden power supply problems (maybe). This is while the project was building, before this problem started.
When the PC came back online I've noticed that the changes I've made to the program prior to the sudden power down was not saved. And, it won't build anymore.
This worked for me:
Shut down VS.NET
Browse to the project in Windows Explorer
Delete the /obj/ folder.
Delete the project outputs (.dll and .pdb) from /bin (not sure if this step is necessary)
Can't hurt but might help: delete the project outputs from any other project /bin folders in the solution that is having issues (wasn't necessary for me)
Restart VS.NET
Rebuild
http://weblogs.asp.net/ssmith/archive/2003/08/12/23755.aspx
As requested, my comment as an answer:
Try cleaning the solution (under the Build menu in VS).
Since the build was interrupted half-way through by your power failure, the file isn't locked -- the build system is probably just in an inconsistent state (which a Clean Solution should fix).
This happens once in a while in my environment and the problem probably has to do with the PDB file being locked (i.e., I'm guessing the last part of the error message is missing in your post). This is how it looks on my machine:
Unexpected error creating debug information file 'c:\dir\obj\file.PDB' -- 'c:\dir\obj\file.PDB: The process cannot access the file because it is being used by another process.'
In my case, cleaning the solution does not solve the problem and restarting is an overkill, so I usually just copy the full name of the pdb file (from the error) and execute this on the command line:
ren c:\dir\obj\file.PDB *.old
This worked for me: Close Visual studio and open visual studio using Run as Administrator and problem was solved.
Not need to restart or delete the file.
Just rename the file and that is enough. If you try to delete the file it will give an error. Better just rename it & it will work. :)
If you are having this problem with a web application, this can happen in the unusual situation that you have used DebugDiag and created a rule that listens on your project's app pool. Deleting the rule prevented this problem from recurring.
This might happen, for example, if you followed these instructions for diagnosing a stack overflow exception in IIS.
If you are working on VM with two user, make sure the other user has not attached all the process while debugging.
Cons of restarting VS:
Clipboard will be lost
Redo/undo will be lost
Files open will be lost
You will loose the tempo
Solution:
Give your Assembly a new name. No cons. Except you will have to rename your assembly back to its original name when you are ready for final deployment. And I think anyone can find how to make it work for the last time :)
Sometimes all the files from \bin folder are used by a running process, i.e. web site on IIS or windows service run automatically after build. In such cases turning off the service or stoping IIS app pool for specific site should also help (like in my case)
Sometimes I run into this problem, when compiling the same project for (very) different targets:
VS2008 and net35
VS2017 and net462
dotnet core 2.0
My guess is, that either bin and/Or obj directory are used by the compiler, but the outputs are not compatible (of course). Solution clean from VS indeed helps.
Often we specify different dll names for the output (e.g. mylib.dll, mylib35.dll) and the issue never happened on those projects.

Categories