Windows Service not updating when code changes - c#

Hi i'm new in Windows Service c#. i followed tutorials and it works perfectly after installation.
Now my problem is when i modify the fonctionnality of the service (modifying c# code), and i uninstall & install the windows service, the functionnality remains that of the first installation.
I even restarted the PC and the functionnality and the functionality has not changed
Is there someone who had this problem?

I also had the same problem.If you are using visual studio installer, just delete the .msi and setup.exe from "XXX\Release" folder and rebuild visual studio installer project. It will recreate both files with updated code changes.

Right click solution > rebuild. Then run your service again.

In order run the updated service in Windows which is created in c# follow below steps
First of all stop that service in windows service manager (services.msc)
Then go to build menu in Visual Studio and click on Rebuild Solution
Then go to services and start the service again.
In this way the updated service will run if it is build successfully and the service is created accurately otherwise you will get Service Failure alert in Windows with specific error code.

I had the same issue and the solution I tried is different from the marked answer.
Right click the setup project (you get a popup window). Click Configuration Manager button at top right, from Active solution configuration dropdown, check whether the selected value is Release. If it is Release then Release folder is updated on building the project; else Debug folder.
Hope this will help a few having such an issue.

Related

clickonce update of visual studio not working

I publish my application from project properties of visual studio and i set the update-path to one of my local drivers E:\WebSiteupdate. The update must run before application starts but i do not really know what should i put on E:\WebSiteupdate to update the application.
here what i used to do for update:
another publish from new application
copy all of new publish folder in E:\WebSiteupdate
but nothing happened and still show old program
what kind of files should i put on update path for update application?
Clickonce's auto updates are meant to update installed applications. That has nothing to do with the project run from VS. When you set Update location, each time the app launches it will check for a newer build/publish in that location. If there is a different build, it will automatically update your installed app. To answer your question what kind of files...? Its is the same contents that you get while you publish your app.
To try this:
Set your Upload location(Project properties --> Updates...) to a path accessible from your pc.
Publish your app to a different location lets say D:\Publish\
Install the app in your pc. There should be D:\Publish\setup.exe. Double-clicking that will install. This will put a shortcut menu in the start menu.
Make any minor change in the UI of your project (in VS).
After clearing the contents in D:\Publish do another publish.
Clear the contents from the Update location and copy over the contents from D:\Publish.
Now (don't do another install) close (if already open) and open the app again (shortcut should be present in Start menu)
The app should update automatically before opening. This is how we are expected to give app updates to the clients. Further, if you like to automate this I found the below link by deadlydog very helpful: http://blog.danskingdom.com/continuously-deploy-your-clickonce-application-from-your-build-server/

How to View the Windows form application In Windows Service Application running as service

I have a Windows Service Application which contains one Service.cs and one Windows Form Application.Now as per my requirement i have to make a setup installer of this application which i did using Visual Studio Setup project under Deployment Section.
Now if i will install my setup Windows Service file will be added as Service and we can see it and its working fine also but i am not seeing the windows form application.
In the control panel add/remove program my application has been added as i am seeing it but windows form application is not showing in All programs of start button.
Please help me .
Thanks in advance.
If this is urgent:
In the File System Editor for the setup project, it should show the target machine's file system. By default, the primary outputs you've specified will be set to install to the "Application Folder". But what you want to do is to look under the "User's Programs Menu" (I can't remember if this shows up by default - if not, right click "File System on Target Machine", "Add Special Folder" and select this folder).
Then, in the right-hand pane, right click and choose "Create New Shortcut", navigate down through "Application Folder", select the windows forms application and hit OK. Then give it a suitable name.
If this isn't urgent - go and find a better setup tool and learn how to do similar things to the above using that tool. Visual Studio 2010 was the last version to include the Setup project support, so spending time learning this tool now is wasted time. Better to find a tool that will continue to work as you upgrade VS versions. I'd normally suggest WiX since it comes at a great price (free) but it does have a learning curve (since you author the setup in XML).

Unable to activate windows store app the app didn't start

First of all I would like to say that I already tried all the solutions I could find on the internet, including Unable to Activate Windows Store App
I recently upgraded my Windows 7 machine to Windows 8.1 to be capable of developing Windows Store apps using Visual Studio 2013. When I open a blank project (Windows Store -> Blank App) and run it I get this error:
Unable to activate Windows Store app 'Package Name'. The App1.exe
process started, but the activation request failed with error 'The app
didn't start'.
See help for advice on troubleshooting the issue.
I already tried:
Reinstalling Windows (Clean install)
Reinstalling Visual Studio 2013
Installing Visual Studio 2012 (same error)
Deleting "bin" and "obj" folder
Cleaning the solution
Uninstalling the app from start menu
Creating a new project
Acquiring the license multiple times (the license is valid)
Making sure that app.config doesn't exist
Investigating the Windows Event Log which says
Activation of the app 'Package Name' for the Windows.Launch contract failed with error: The app didn't start..
but found nothing useful
Adding a new Windows user
Run everything as administrator
and at last, changing the desktop background :)
None of this did bring a solution. Does anyone have an idea what else could be the reason for this error?
Thank you.
I found a solution. The problem was that the drive I was working on was encrypted (TrueCrypt). Moving the output folder to an unencrypted drive solved the problem.
If switching from x86 to x64, make sure your Project Properties Platform Target and Configuration Platform are BOTH set to X64.Hint you need to change to x64 debugging in the Build menu/Configuration Manager dialog to get the Configuration Platform in Project Properties to update.
This caused the activation error problem to be resolved for me
HTH
Robert
I had the same Error and tried after loading the SQLite Package for WP 8.1 some things above:
not working:
Clean and Rebuild
Restart Computer/Phone
what did the deal (for me)
I put Platform Target under Properties -> Build to ARM instead of x86
Hopefully this might help somebody else facing this ridiculously informative Errormessage.
I had the same problem with Visual Studio Community 2015 while trying to debug an Blank App (Universal Windows) using Visual C#.
Visual Studio was installed on Disk C:(SSD), and Project files were placed on D:(HDD). I´ve created a Folder on C: Drive and placed my test project there.
After that Error messages gone.
If you are receiving this error and are developing for Microsoft Hololens:
You are trying to build to a device that is asleep. To wake your device, tap on the button on the back (on/off button).
Good luck!
I've tried all the solutions found on the net and none applied to my case, not even this one.
The only way I could make it work was changing the Package Name in the appxmanifest.
This made me think there must be some leftovers somewhere around with the old package name, that are either corrupted or inaccessible because of some permissions issues.
It might be just a coincidence but the problem appeared twice after I tried using the app verifier (appverif.exe)
Now I reassociated my app to a store app package and things seem to continue working...
In my solution, I have a non-UWP project (Multiplatform development) that builds with a different Solution Platform.
I was attempting to run the UWP project in Debug, but as the wrong Solution Platform.
Edit:
I also get this when I build my project for Any-CPU, instead of x64.
Ensure that ALL APPLICATION PACKAGES has "read" permissions on C:\Windows.
My organization's group policy likes to strip all permissions from C:\Windows, including the ALL APPLICATION PACKAGES group . By adding it back in and setting Read & execute, List folder contents, and Read, I'm able to run the app from Visual Studio without any problems.
See What to do if your Windows 8 Modern App fails to start for more tips, including this one.
I had the same problem in Visual Studio 2015 Update 3, Windows 10 Build 10586.494.
The error came up when trying to start any UWP app that I compiled without .NET Native Toolchain. With Native Toolchain enabled, the apps would start.
Installing a new (blank) app manually fixed the error for me:
Start VS 2015
File > New > Project.
Blank App (Universal Windows) Visual C#. OK.
Make sure to be in Debug config
Right click on Project > Store > Create App Packages
No. Next.
Select Debug for all architectures.
Create
When packaging is finished, open Explorer to the project path / AppPackages / [...]_Debug_Test
Right-click on Add-AppDevPackage.ps1 > Run with PowerShell
Follow the instructions
Start the installed app from Start Menu
I had the same problem a couple of weeks ago. A simple restart helped me out.
Also tried this one?: http://irisclasson.com/2012/11/04/problem-unable-to-activate-windows-store-app-the-app1-exe-process-started-but-the-activation-request-failed-with-error-the-app-didnt-start/
Hope its usefull to you
I managed to fix the same problem by rebuilding the solution. (In Vis Studio 2012)
I have tried many solutions and nothing worked. At the end what worked for me was to change the startup project to windows phone 8.1 and after it runs OK I changed it back to windows 8.1 and it runs OK. It works for me as I am making a universal app. Hope it helps anyone else.
I had the same issue with a Windows Store App after moving some files around. I ended up opening an older file (as Admin) to see if it would run and found that it did. I then returned to the file that would not and it ran also. I believe opening the older file (as Admin) reset the paths for development and the permissions. Hope this helps.
Same problem - moved my project from the TrueCrypt Partition and all was fine.
I had a similar issue, solved by choosing a new publisher certificate. And of course restarting Windows
I had same issue. Selecting proper Platform solved my problem. i.e. My application was selected to run under x86 platform, while my OS & SDK supports x64. Selecting x64 solved my problem.
I had the same problem on a UWP app when creating a package for Testing, but not when runing directly from Visual Studio 2017.
The solution was to select only the architecture that I am using to Debug the App, Instead of all options (x86, x64, ARM).
Here is the option choosed on Visual Studio
There are can be a couple of things that might be causing this problem.
Here are the trouble shooting steps that helped me out:
Step 1 : Check to see if running visual studio in the elevated mode (Run as an Administrator) helped solve the problem. (Sometimes, your folder permissions might get mangled due to various softwares that you might have install)
Step 2 : Delete all the bin and obj folders in your project and rebuild the projects in your solution manually.
Step 3 : Do a quick check of your System Type (x64 or x86 etc) and see if your project is targeted for the same.
Here is how to do know your system type: Win + R > cmd > systeminfo
If it says x64, then make sure to select the Solution Platforms (In visual studios top action bar) as x64 or so forth depending on your architecture.
Thats all I did to solve my problem.
I had unticked an option while trying to get debugging working prior to this error, the fix for me was to re-check the "Compile with .NET Native tool chain"
A rather niche situation and solution...
I was remote debugging a UWP app for a while successfully. After some reworking, I ran into this issue. In the main app project I had set the windows version compatibility accordingly (I am running the app on a Windows 10 IoT Enterprise 2019 device) but had forgotten to match those windows target and minimum versions for the Library Project that was in my solution.
After cleaning and re-deploying the solution (first uninstalling the app from the remote device), the problem went away.

Weird behavior when opening web project in Visual Studio 2012

I have a solution with a web project (the "main" project - lets call it the DataPortal project.) where the project will not open unless take the following steps.
Open solution. The DataPortal project is greyed out and says "Unable to open project".
Right click the DataPortal project node and choose Edit DataPortal.vbproj
Change the UseIIS node in the project from True to False. Save the file.
Right click the DataPortal project and choose Load Project. The project loads.
Now open the DataPortal project files Property page. (Alt-Enter)
Check the option button in the Property sheet that says Use Local IIS Web Server.
Check the checkbox that says Use IIS Express. The Project Url already has a value in it.
Now everything works great. And I can work until I shut down VS but when I re-open the solution I have to go back through it all again.
Can anyone tell me how to fix it so that UseIIS is okay at startup? Is there some way to get insight into the project load error for more information about it?
Maybe you could try to start Visual Studio with the log switch and see if it reports anything.
devenv.exe /log
(/log documentation on msdn)
Also, when Visual Studio behaves strange I usually delete both *proj.user and *.suo files and sometimes it resolves the issue.
Try deleting (or editing) your DataPortal.vbproj.user file. I had this problem a few days ago, and I think that's what I did to solve it. Project settings that aren't team shared (which may include run settings for your web app) are in this file.
Probably you have some problems with IIS port.
Try to diagnose using Fiddler or looking into IIS logs...

Setup and Deployment does not work

I am working on VS 2008 and 3.5 framework.
I had three windows services.
I placed all three in a single solution, created installer individually for each of them.
Then created a setup project.
When I build it says build failed .
But I checked on the errorlist, (i enabled the diagnostics in options menu), but there was no error at all.
I went ahead and installed. There were no issues, But there was no service showed up in the services.msc.
I installed each service individually , using installutil command, it showed up.
But my requirement is to bundle these services and deploy to the client.
The client should install it.
Where am I going wrong.
Any inputs will be highly appreciated.
Regards
cmrhema
I notice your comment above about omitting the custom action. Same mistake I made! For posterity, here's the entire process:
Make sure you have added the project installer to your service project (described here). These components give your service EXE the ability to register itself with the service manager.
Add a setup project to your solution.
Add the primary output from your service project to the setup project (described here). This puts the binary into the application directory.
Add a custom deployment action to your setup project containing the primary output from your service project. This looks like a repeat of step 3, but what it's actually doing here is registering your service with the service manager.
This walkthrough goes through each of these steps in some detail.
I too have a similar problem with VS 2008 and I believe it is a bug in the IDE rather than anything you're doing wrong.
Basically what happens is that VS reports a failed build, but does not indicate any reason for the failure. I find that restarting Visual Studio and then performing another build allows the build to succeed.
I read somewhere that for some people the bug is caused by some auto-created project file, but a restart fixes the problem for me.
Build failed -> what else is there in the Output window?
For some general reference regarding setup projects for windows services in .net:
http://msdn.microsoft.com/en-us/library/aa983650%28VS.71%29.aspx
http://support.microsoft.com/kb/317421

Categories

Resources