Why do we need to restart the CRM server after registering the custom workflow using Plugin Registration tool to make that work properly - workflow

Can we have any alternative way to make run-able the custom Workflow activity in Workflow steps.
All the time what I do is register the dll using Plugin registration tool and then restart the server. Then only we can use the custom workflow activity on Workflow.
I have tried after restarting the IIS and hoping so it'll be done but no luck.
All the time restarting server should not be any solution. Is there any alternative way for it please suggest. All you are suggestion would be greatly appreciated.

1) You do not need to restart IIS; restart the application pool (its far faster and doesn't disrupt other applications that might be running on the server; by default its the 'CrmAppPool') using the command:
%systemroot%\system32\inetsrv\appcmd recycle apppool CrmAppPool
2) Similarly, you can recycle the async process by running (powershell):
Restart-Service -displayname "Microsoft Dynamics CRM Asynchronous Processing Service"
3) Both of these commands can be run remotely using the powershell command:
powershell Invoke-Command [CrmServerName] -ScriptBlock { ["Restart-Service...."] }
4) You do not need to deploy to the server to debug plugins. Its far easier/faster to create a test harness. The link below outlines how to setup a dev environment for unit testing.
How I develop and unit test CRM 2011 plugins

CRM caches the dlls, restarting the services causes it to refresh those caches.
If you register a synchronous plugin then you need to reset IIS.
If you register an asynchronous plugin or custom workflow activity you need to reset the asynchronous service.

We don't need to restart the server to make it run the plug-in code, the only thing is you need to restart IIS after that.

Try restart IIS and then restart the asynchronous service, this must be the only thing necessary.

The point here is very specific -
It's not only true for the CRM, but is also true for any web application hosted on IIS. Web App (CRM for you case) caches dlls for the very first time when the message is executed (plugin message/event - Although this is done by .net platform internally, so to address the other similar calls more efficiently.). So, in that case you need to flush off the synced thing from your web app. And that is why you need to recycle app pool (SMART WAY -> for single application flush, and without impacting other applications on the server, you should always go for APPPOOL Recycle instead to IIS restart.)
For this, what I would suggest you is to write a powershell script to recycle AppPool for your application and trigger it on Post build event of your project (plugin project) in VS. So, that will make your process automated and will reduce your efforts to much lesser.
Regarding custom WF assembly, Since it executes under Async. Service, so you need to discard off the cached content from here as well.
Hope this helps!

You shouldn't need to restart anything.
What you need to do is increment the build number of the assembly you are updating each time you deploy it.
This makes sure that CRM knows not to use it's cached version but to load the updated one the database

If you want to see the CWAs without any need of restarts just select the activity in the plugin registration tool and press the "save" button below the properties

Related

Updating Deployments SCCM

I'm super new to SCCM and trying out some stuff.
Atm I create a lot of Applications to deploy on around 50 Clients.
Before I deploy them to all clients I test them on a test Client.
The problem now is that if I change sth in the Deployment Type like the installation command I have to delete the deployment everytime afterwards and deploy it again or the change wont happen on the client when I install the Application next time.
There probaly a way easier method which I can't figure out atm.
So how do i update the changes I made after the Application is allready deployed?
Greetings,
Paxz.
The application deployment command line will only be executed if the application is not detected - i.e. the Application Detection criteria evaluates to false. With this premise, it is possible to change the Application Detection criteria so it evaluates to false... perhaps add an addition rule to include "file1.txt exists"? This should work, but it is ugly and I would not recommend it.
A better approach
I prefer to test my application deployments on VMs in the first instance: prepare the destination machine, snapshot it, then deploy.
If you need to tweak your deployment you can then make the required changes, redistribute the content (if required), then restore the VM's snapshot for a fresh deployment.
I managed to get an answer from microsofts technet forum.
For deployments to know the update in the command line, I just have to push the next policy polling cycle.
This will only be effective for clients that haven't executed the deployment type yet.
Other than that there seems to be no other way than deleting the deployment and re-deploying it for the changes to be known for the deployment.

How to start and stop a web application and database in VSO with vNext tasks

I've setup Continuous Integration in my project hosted at Visual Studio Online.
Among other things, I deploy my web application to a test slot and test database and I run integration tests.
However, I don't need the test slot and database to be running all the time. I would like to start them both for the integration tests to run and stop them after my integration tests are done, all automated.
I played around with the Azure PowerShell vNext task, but I couldn't figure out how to accomplish this. Any help would be appreciated. More than the actual answer, I would appreciate a link with more information, if possible.
For the web app slot, you can add AzurePowerShell step in your build defition can create two power-shell script: one start the website via Start-AzureWebsite command before the build start and another one stop the website via Stop-AzureWebsite after the testing is finished.
For the database, you cannot stop it. Refer to this question for details: How do I stop and start a SQL Azure database?

Is Quartz.Net appropriate to run a long process started from an ASP.Net 3.5 page?

I have a long running task (many hours) that is started via a web page on an intranet interface. This is an ASP.Net 3.5 project. Of course, I could extend the script timeout and let the page run for several hours, but I don't think this is a clean solution. I read somewhere that long running tasks should not be children of a Web Application Pool, since it could be reset by IIS at any time. Searching for a solution, I read a bit about Quartz.Net, but most examples are talking about recurring jobs. I was wondering if it were also appropriate for tasks that should run only once when a user asks for it. Or is there another better solution?
Also, if Quartz.Net is a good way to go, should it run as a Windows Service, or should it be spawned by the ASP.Net web site using Global.asax?
Quartz.net works just fine for this scenario. You schedule a one time job on Quartz.net and let it run for as long as it needs to. At work this is exactly how we run many of our jobs.
You should set up Quartz.Net as a windows service though. IIS recycles web apps and if you run Quartz.net within your web app it will get recycled along with you web app by IIS.

how can I set up a continuous deployment with TFSBuild for MVC app?

I have some questions around the best mechanism to deploy MVC web applications to different environments. Previously I used setup projects (.msi's) but as these have been discontinued in VS2012 I am looking to move to an alternative.
Let me explain my current setup. I currently have a CI setup using TFSBuild 2010 with Team Foundation Server for source control.
A number of developers work on their local machines and check in to the TFS Server. We regularly deploy to a single server dev environment and a load balanced qa environment with 2 servers. Our current process includes installing an msi which carries out some of the following custom actions:
brings current app offline with the app_offline.htm file
run in database scripts (from database project in the solution)
modifies web.config (different for each web server of qa)
labels the code
warmup each deployed file via http request
etc
This is the current process. Now I would like to make some changes. Firstly, I need alternative to msi's. From som research I believe that web deploy via IIS and using MsDeploy is the best alternative. I can use web config transforms for web config modifications. Is this correct and if so, could I get an outline of what I need to do?
Secondly I want to set up continuous delivery via TFSBuild, I have no idea how this may be achieved, would it be possible to get an outline of how it can be integrated in to my current setup? Rather than check in driven, I would like it to be user driven following check in. Also, would it be possible for this to also run in database scripts from a database project in the solution.
Finally, there is also a production environment, but I would like to manually deploy this - can my process also produce an artifact that I can manually install?
Vishal Joshi has some information on his blog that is reasonably good, http://vishaljoshi.blogspot.com/2010/11/team-build-web-deployment-web-deploy-vs.html. It does have the downside that your deployment password is include in the properties you pass to msbuild.
Syed Hashimi has also posted some information on this in another questions Team Build: Publish locally using MSDeploy.

Best practice deploying windows service

I'm looking for best practice in continuous delivery of windows services.
Currently we hava a set of powershell scripts that unintall, reboot, install updates but error handling is tricky. We are reviewing System center but are there any other options available for deploying a windows service?
We've been using Presto since Dec 2011, and have done over 1,000 deployments. Most of what we deploy are Windows services.
What's nice is that we set up our apps and servers in Presto, then we can repeatedly deploy, to any server (or multiple servers at once), by just hitting a button. Presto will copy our official release binaries, update all of the items in our app config files, create and start the service, etc...
So, if you have an application that has 30 manual steps to deploying it, you can enter these steps in Presto, then it's done automatically for you after that.
It's worth a look: http://presto.codeplex.com/
Your most basic and generally accepted best option comes from this thread, which basically links to a Microsoft support article on creating an installer for the windows service.