If you are having trouble with getting remoting to function properly and you know you have everything configured properly then it is more than likely caused by a bad or incomplete dll. Here is a list of things to try before giving up on trying to get this to work.
1. Remoting errors are never helpful and usually will be a 500 Internal Server Error:
This will occur when the proxy object attempts to access the remoting server and fails. Literally what happens is an error occurs on the remoting side (proxy side) and instead of return something useful it will return the following block of text:
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”> <html xmlns=”http://www.w3.org/1999/xhtml”> <head> <meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″/> <title>500 – Internal server error.</title> <style type=”text/css”> <!– body{margin:0;font-size:.7em;font-family:Verdana, Arial, Helvetica, sans-serif;background:#EEEEEE;} fieldset{padding:0 15px 10px 15px;} h1{font-size:2.4em;margin:0;color:#FFF;} h2{font-size:1.7em;margin:0;color:#CC0000;} h3{font-size:1.2em;margin:10px 0 0 0;color:#000000;} #header{width:96%;margin:0 0 0 0;padding:6px 2% 6px 2%;font-family:”trebuchet MS”, Verdana, sans-serif;color:#FFF; background-color:#555555;} #content{margin:0 0 0 2%;position:relative;} .content-container{background:#FFF;width:96%;margin-top:8px;padding:10px;position:relative;} –> </style> </head> <body> <div id=”header”><h1>Server Error</h1></div> <div id=”content”> <div class=”content-container”><fieldset> <h2>500 – Internal server error.</h2> <h3>There is a problem with the resource you are looking for, and it cannot be displayed.</h3> </fieldset></div> </div> </body> </html>
This block of text is the html of the image directly above. The one thing to keep in mind is if you see this, then you need to make sure that everything is configured properly first, make sure the remoting URL is correct. Pay attention to the errors returned though because sometimes they are not the 500 error. If it is a 404 error then you know that the URL you provided was wrong. If the configuration is fine then go through the steps listed below.
2. Manually delete all dlls and recompile everything. You must make sure to move your base project dll to the remoting project’s bin folder. After successfully recompiling the remoting server dll (and respective interface library), should you move the remoting dlls to the base project’s bin folder. No part of this exercise should fail. Make it a habit to periodically move the base project dll to the remoting project’s bin folder to give it an update copy to work with. That is where the remoting server gets its meta-data from.
3. Make sure that the interface library looks exactly the same on the consumer side and the remoting side (proxy side). If the interface differs at all, then you will have failures.
4. Sometimes, during debug, .Net can get all mucked up with bad cache and you will see a message like this:
In the path that is provided in the picture you can see the directory name, this directory name is the same name as the virtual directory used in IIS. This is where all of the cached information for the web application is stored. The problem with this picture is I was getting this error when I was running a different virtual directory which has nothing to do with that other virtual directory. The solution here is to reset IIS by running the following command at cmd:
iisreset /restart
If you continue to have this problem then you should do the following:
- Stop IIS via cmd:
iisreset /stop
- Open up the affected path, in this case open:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files
- Locate the virtual directory that is giving you trouble and delete it. This is safe to do because it will just be re-cached when you run the application again.
- Start IIS via cmd:
iisreset /start
- Run your application to re-cache it. This could take longer than usual so be patient.
This error message can also appear if you are trying to attach to a process with an old debug file. The way to fix that is to simply rebuild your files and make sure you are in debug mode. If you attempt this during release mode you will get this error message too.