How do I stop an instance of a custom DLL in Windows Server 2008 R2? - windows

One of my Visual Studio projects generates a custom DLL that is run in a folder of the main web site (and the web site is a web site, not a web application, so I'm not publishing from VS - all files are copied manually). Whenever I make changes and overwrite the DLL, I don't immediately see my changes, I suspect because the web site is running the original DLL file cached in memory.
How can I identify and stop the process that is running the DLL? Even if I delete the DLL from the folder the site still runs just fine, sans my changes. I have also stopped and re-started the application pool and site in IIS.
"Back in the day" we would stop a svchost process, but I don't see anything like that in task manager.
Thanks for any help you may provide!
Mike

Go and get Process Explorer, it has a feature called DLL View that will allow you to see which DLLs are being used by which process.
Read Getting a list of DLLs currently loaded in a process for screenshots of how to enable DLL View.

Related

Copying DLL to server vs Visual Studio site publish

ASP.net MVC (v5.2.7) solution with a project, separate from the web project, that compiles to dll that gets copied to the /bin directory on the web server during site publish. That dll will modify the user's UI based on class settings. If I change the class and do a whole site publish, I get the UI change I expect.
However, if I compile the dll's project in the solution, take the resulting DLL and copy it to the web server /bin directory, I never see the UI change. I can see the date/time stamp is different. The version# has incremented. I've stopped/started the app pool. I've stopped/started the site. I've stopped and started IIS. I've closed the browser. I've used a different browser. But when copying that single dll by hand and dropping it in the site's /bin folder on the server, I never see the UI change I expect. When I do a full site publish, I see the change I expect.
What is msbuild and msdeploy doing that I am not?

SharePoint development in visual studio without having to deploy/debug on every code changes

I'm using VS2010 connected to a local SP2010 installation, I edit the code in VS2010 (i.e. of a WebPart) and then in order to see the result on a browser I deploy the solution.
This is very annoying since it is a big project and it takes a couple of mins to deploy the solution.
I was wondering if it is possible to have the "edit -> save -> F5" approach even for SharePoint.
Thanks!
I'm gonna to integrate here the answer i get from the kind ppl and what i've actually done to solve/mitigate my slowness problem:
Installed CKSDev Visual Studio plugin from here: http://cksdev.codeplex.com/
On the SharePoint project properties tab set to 'True' the property 'Auto copy to SharePoint root', with that on each time you do save a 'visual' (ascx, aspx, js, css, ..) source file, it will be automatically copied over the SP hive without having to manually push it using the Quick Depl. option
On SharePoint project properties page (right-click, properties), add the following post build event command line:
"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\gacutil.exe" /i "$(TargetPath)"
iisreset
The previous commands will:
Install the project dlls into the GAC
Restart IIS in order to catch the new dlls
Now each time you do save a change in the visual or build the code it will automatically pushed to the SP installation.
For newer source files i still need to normally deploy the project.
You can do that by copying the modified file to the corresponding folder inside SharePoint Hive[14] (Or you can edit it there directly), and recycle the application pool.
Note that it this solution is only applicable to web parts, pages and xml files and it cannot be done for code files.
If you have modified your code files you have to recompile them and copy the dlls to GAC[%systemroot%\assembly] or BIN[14\bin] folder depending on your settings.
Download CKS: Development Tools Edition (aka CKSDev) from here and install into VS 2010. You will see new context menu "Quick Deploy" in solution manager which will speed up requested tasks: deploy to GAC/BIN, Recycle App Pool and more (shortcuts are accessible!). Very handy tool.
Use CKSDev, and separate your solution into smaller solutions so you can work on a subset of your projects, I would be very surprised if your webpart is dependent on every project in your master solution. If you are developing on a virtual machine without internet access also ensure that you are not waiting for timeout on your certification checks everytime you recycle the apppool (happens when you deploy). Read here for how to: http://joelblogs.co.uk/2011/09/20/certificate-revocation-list-check-and-sharepoint-2010-without-an-internet-connection/
I am going though below step during debug code.
1) if you are changes only code assembly than Build Your Project after changes code.
2) Open Assembly folder(run > assembly) and drag and drop your project's dll(will be found it out from Your Project Directory\bin\Debug).
3) open IIS (run > inetmgr) and goto Application Pools and find it out your sharepoint we-app's Pool. after selecting Application Pool (Recycle) it.
4) now come back on VS SharePoint Project.Debug > Attach to Process > w3wp.exe.
should be hit your break point.
that's it.

Every time I open my project I have to create virtual directories

I am currently working on a solution which has an ASP.NET application and a Web Service. Whenever I open this solution I get the message that the virtual directories for this project have not yet been created and must be to continue. The problem is, if I hit OK, it cannot create the directories because they already exist and then I cannot load the project. Looking in IIS I can see that the virtual directory exists in C:/Inetpub/wwwroot/ProjName. If I delete this from IIS, I can then open the project, but it creates the virtual directory in C:/location of project folder. When it uses the project's location, I am not able to connect to the site or the web service.
The same thing happens on XP with IIS 5.1, VS 2010 and Server 2003 with IIS 6.0, VS 2010. Similarly, it happens on colleague's machines, so I am convinced that it is a setting in VS, and not IIS or my machine.
Right now, my solution is to delete the virtual directories, open the VS solution, delete the virtual directories, and publish the projects with the publish toolbar in visual studio (not the web tab in project properties).
I fear that I've at some point messed up a setting on both of the projects, but it has been some time since I've been working around this. I've scoured all of the settings and I can't find anything that fixes this behaviour. I need to pass the project along to someone else, and I feel as if the work around instructions may be confusing so I want to fix this.
I used to do things similarly back in the days when VS didn't have its own dev server - re: directly work on web projects in a local version of IIS (if memory serves, this was called "Personal Web Server" or PWS - am I advertising my age?)
Anyway, I haven't (thankfully) done that since VS (2005?) got its own dev server...
Try this process in VS 2010:
You can develop your solution on any local folder in your file system. You can run/debug your solution from VS (ctrl f5 or f5 respectively) - it will use VS dev server by default. Your development machine doesn't even need to have IIS...
After you are done developing and debugging (using VS and its dev server), you can publish to IIS or even to some other "publish folder" in your (local) file system, and simply copy the files to whatever (local/remote) IIS virtual (ASP.NET application) folder you prefer.

Build error in VS 2010

I am getting this error in my application
Error 1 Unable to copy file "D:\myproj\bin\Debug\myproj.dll" to "bin\Debug\myproj.dll". The process cannot access the file 'bin\Debug\myproj.dll' because it is being used by another process.
How to fix it
Your project dll is being used by another process. Either you ran your application and it didn't fully shut down (check the task manager) or some other program is trying to consume the dll in the d:\myproj\bin\debug\myproj.dll
For example, in the olden days, if you used a .Net dll in a VB6 app, and pointed to the debug dll, it would grab on to that and you'd have to shut down VB6 to free the dll.
I suspect you'll have to do something similar.
Start by checking task manager and making sure your app isn't still running.
Then close down any other apps that have a reference to your dll
If neither of those two work, close down studio and restart it

Visual Studio Keep Session between rebuilds etc

I would like to know if there is a way to keep the session going.
I've got sick of losing my session between rebuilds/builds, if I change too much in my project or submit code to our SVN (tortoise via VisualSVN). I'm developing an ASP.NET MVC project with lots of jQuery.
I would like to do this as I test my project on one screen with Firefox (Firebug wins) and edit on the other in visual studio. As my project has a session system and I would like to be able to develop without having to keep re-logging into my system.
Thanks
Edit:
Visual Studio 2008 Professional with the build in IIS development server.
Windows Vista Business 64bit
I don't think that's possible, given that the application restarts on each build. What you could do though, is add a temporary jQuery post call to the login page, that will run on startup.
$(function() {
$.post('/login/', { username: 'phil', password: 'noonewillguessthis' });
});
That way you'll be logged on to the system "automatically" each time the page loads. Just remember to remove it before you deploy live... ;)
It is not possible, when you rebuild and change the content of your libraries they have to be reloaded into the process space. However, in .Net you can never remove assemblies from an AppDomain once they are loaded. To reload your library the AppDomain needs to be unloaded and loaded again. In addition, if there are any changes to your web.config, it will also unload/reload your AppDomain.
You could use something like pushing session state to SQL server so that the AppDomain recycle doesn't impact you. You can do this with the sessionState element of the web.config file.
I have faced the same problem. I use VS 2015 on a machine. I rebuild/build project and on my first debugging the first generated session is lost. Think i mention about 2 paged project. first page is "Default.aspx", second page is "Home.aspx".
Default.aspx page is loaded first
Session["UserID"] is generated on Default.aspx
Page is redirected to Home.aspx by using Response.Redirect("Home.aspx",false) code.
Session["UserID"] is checked on Home.aspx.cs' s Page_Load function if it is existing or not
Session["UserID"] is not existing.. lost!
Solution:
I have instaled Visual Studio on other machine and I built the project on that machine. As result session missing problem is solved. Publishes are worked well on servers too. Maybe this problem is sourced by Visual Studio configurtions or machine configurations, I am not sure but installing VS may solve the problem.

Resources