Service Fabric services debugging issues - c#

I have 2 Service Fabric services, which I need to debug. Those services communicate with each other.
I am using:
VS 2017(update 7),
.NET Framework 4.6.1,
Azure SDK 2.9.5.3,
Service Fabric Tools 2.0.20180124.2,
Service Fabric 6.1.456.9494,
Service Fabric SDK 3.0.456.9494
Everything was going alright, but at some point I've started to get following errors, when I try to start debugging 2nd service.
I don't understand why I am getting those errors.(Google produces absolutely nothing on those errors) Here they are:
1st error: Error MSB4064 The "ProjectReferencesWithConfiguration"
parameter is not supported by the "GetServiceProjectReferences" task.
Verify the parameter exists on the task, and it is a settable public
instance
property. \packages\Microsoft.VisualStudio.Azure.Fabric.MSBuild.1.6.5\build\Microsoft.VisualStudio.Azure.Fabric.Application.targets 95
2nd error:Error MSB4063 The "GetServiceProjectReferences" task could
not be initialized with its input parameters.
\packages\Microsoft.VisualStudio.Azure.Fabric.MSBuild.1.6.5\build\Microsoft.VisualStudio.Azure.Fabric.Application.targets 94
Here is complete scenario:
One of the services(does not matter which one) in one copy of VS has started successfully without errors.
I've trying to start 2nd service in another copy of VS. And during this attempt I'm getting errors I've mentioned above.
To remedy the situation I have to close offending copy of the VS and open ServiceFabric service project in new VS copy and after that service will start successfully.
Unfortunately all that dancing are getting quite annoying because it's taking up A LOT OF time.
Any help would be appreciated.

I solved this by upgrading Nuget package Microsoft.VisualStudio.Azure.Fabric.MSBuild from version 1.6.4 to 1.6.5
After that also had to manually change 1.6.4 to 1.6.5 in the .sfproj file, as Nuget package manager did not do that automatically.

I had the same issue after upgrading Visual Studio to version 15.6.4 (can't remember what my previous version was). Tried altumano's solution of updating Microsoft.VisualStudio.Azure.Fabric.MSBuild and ran into other errors.
Solution that appears to have worked for me is to upgrade Visual Studio again to version 15.6.6. I still plan to update Service Fabric SDK to a more recent version, but so far this Visual Studio update alone has solved my issue.

It looks like updating Service Fabric SDK to 467 version did the the trick.
I've been working all day today and didn't see pesky error messages during services start up. Now I have in Control Panel\Programs and Features following lines:
Microsoft Azure Service Fabric 6.1.467.9494
Microsoft Azure Service Fabric SDK 6.1.467.9494

Upgrading Visual Studio to version 15.6.7 and Service Fabric SDK to version 3.1.269 seems to work.

Related

Can't add Azure CloudService Project to existing solution

Goal: Convert an existing MVC application running on Azure AppServices to run on Azure CloudService. (need to add a library that needs this)
Problem: Error message (below) and the CloudService role appears non-functional
Visual Studio 2017 (15.2 (26430.6))
Actions:
Added new Cloud Services project to the existing solution
Did not add any roles
OK (project created without error)
Added a Role to the CloudService project
"WebRole in project"
Selected the MVC application that already existed in the project
Press OK, error occurs
Note, the project described in the error is the MVC project (not the CloudServices one), so we also removed the NuGet reference and retried with the same result.
Error (retyped):
Microsoft Azure Tools for Microsoft Visual Studio
The following NuGet packages could not be installed in project XXXXXXXXX:
WindowsAzure.Storage (version ‘(unknown)’): Value cannot be null. Parameter name: path1
Ideas?
I found the problem here...stinky error message
The problem was that the Azure SDK was not installed correctly. Modified the installation to include the Azure workload and this fixed the problem.
The Convert to Azure Cloud Services became available and that seems to have worked.
There was no message that the workload was not installed, perhaps because the machine had a version of the Azure SDK installed from previous work in VS 2015. Dunno.

Azure Service Fabric continuous integration fails in Visual Studio Team Services (was VSO)

I have tried to set up continuous integration to deploy my Azure Service Fabric cluster automatically on git push events in Team Services. I followed the default template for a Team Services Build Definition and a Team Services Release Definition based on this guide:
Set up continuous integration for a Service Fabric application by using Visual Studio Team Services
Here are my settings:
For the most part everything works for the first deployment. After that it throws the following error:
An application with name 'fabric:/<APP>' already exists, its type is '<APP>Type' and version is '1.0.0.20160812.7'. You must first remove the existing application before a new application can be deployed or provide a new name for the application.
From that it appears as though it is trying to completely redeploy the service instead of just upgrading the service. I have searched through all of the settings and tried creating and recreating the tasks but have not been able to resolve.
Has anyone encountered this before?
You need to add or update a publish profile to enable the upgrade mode and use that profile to deploy the Service Fabric after the first deployment is succeed.
To do this quickly, you can right click on your project and select "Publish" from Visual Studio, check "Upgrade the Application" option and click "Configure Upgrade Settings" if needed, and then click “Save Profile" link and commit/push the changes.
Though there is an accepted answer, I would still like to add to this thread. In the approach below we need to edit only the Azure Devops Task. Hopefully this will be useful to others who may encounter the same issue: One simple workaround when you encounter this issue is to change the "Overwrite Behavior" under the Advanced Setting for the build task to "Always". However, care must also be exercised so that if there are services which may already be running - all of them do get upgraded via a rolling upgrade (see second image).
To ensure that rolling upgrade is applied to all the services, in addition to the above, also ensure that the upgrade settings are configured as below:

VS2015 Community ASP.NET5 Dependency injection and azure publish errors after UWP update

Until recently i had working asp.net 5 mvc webapi project. It worked locally and i was able to push it to azure cloud (publish option).
About week ago i started to work on universal windows app for rasberry pi 3 - so i installed necessary package (Visual Studio Tools for Universal Windows Apps) with couple more updates from gallery (new version for ASP.NET and Web Tools probably).
When i got back to working on webapi project i've noticed warnings:
DOTNET1015 The 'compilationOptions' option is deprecated. Use
'buildOptions' instead.
DOTNET1015 The 'exclude' option is deprecated. Use 'exclude' within
'compile' or 'embed' instead.
DOTNET1015 The 'publishExclude' option is deprecated. Use
'publishOptions' instead.
in my project.json file
So something must have changed after those updates.
Project build passes but when i start it locally on debug and IIS Express i get:
An unhandled exception of type 'System.InvalidOperationException'
occurred in Microsoft.Extensions.DependencyInjection.Abstractions.dll
Additional information: No service for type
'Microsoft.Extensions.PlatformAbstractions.IApplicationEnvironment'
has been registered.
And when i try tu push it to azure i get some errors in my language (polish) about metabase problems and wrong format of paths eg. lm/w3svc//ROOT/
my project.json file: http://pastebin.pl/view/f823f093
VS info: http://pastebin.pl/view/86bae236
I try to clean and rebuild solution, restore packages but its probably something else.
What can i do except of uninstalling VS and instaling one more time?
Complete uninstall of VS 2015 Comunity and clean install of AspNet5.ENU.RC1_Update1_KB3137909 did the trick for me. Problematic update probably was
https://visualstudiogallery.msdn.microsoft.com/c94a02e9-f2e9-4bad-a952-a63a967e3935?SRC=VSIDE

Microsoft Service Fabric Host Service (FabricHostSvc) Hangs on Start

I've been working with Microsoft Service Fabric since November 2015 and have encountered many issues but now Service Fabric has become completely non-functional on my development machine. Uninstall/reinstall doesn't help.
I was using 1.5-preview and have since tried 2.0 to no avail.
The problem started when I attempted to run a Service Fabric Application from Visual Studio 2015 Update 1 (as I have done hundreds of times over the past few months).
My machine blue-screened (first time I've seen a Windows 10 blue screen). After rebooting, I was unable to get my Service Fabric Application to deploy via Visual Studio. The PowerShell script failed with the following message:
Starting service FabricHostSvc. This may take a few minutes...
Start-Service : Failed to start service 'Microsoft Service Fabric Host
Service (FabricHostSvc)'.
I went into the SCM and found "Microsoft Service Fabric Host Service" was in a state of Starting. It stayed that way for an hour. I tried stopping and starting the service several times and each time it hangs.
I uninstalled Service Fabric (Service Fabric, SDK and Tools for VS) and re-installed with the latest version 2.0 and it exhibits the same problem.
Reboot, same problem.
Removed c:\SfDevCluster folder, same problem.
Based on some other articles, I looked for any stray performance counters after uninstalling but there weren't any.
I tried looking through the registry but there are other Azure components with "Fabric" in the name. If I delete them, I will probably hose the rest of my Azure dev setup.
Now... when I attempted to start the service again, it did re-create the SfDevCluster folder and give me some logs. It seems to create two trace log files per minute and they have the EXACT same contents.
Every time it fails, the final line of the trace is:
Info ,11176,General.FabricSetup.Main,Operation failed with error
0xffffffff
An earlier trace (SF 1.5) seemed to use a constant rather than the hex value for the error. Seemed to indicate an invalid argument.
Whatever this failure is, it seems to be the cause of my woes. Unfortunately, the error is completely unhelpful.
I'm trying to avoid reinstalling Windows because that will kill an entire day of productivity.
Any help is greatly appreciated.
From an elevated powershell session please run: Unregister-ScheduledTask FabricCounters.
This will fix the issue.
I was seeing very similar behaviour and reinstalls of the fabric SDK and runtime, deleting scheduled tasks, deleting the SfDevCluster contents etc. all didn't work.
I was seeing repeated Docker errors in the event log and when I tried uninstalling Docker for Windows SF instantly woke up. I have no idea what the interaction is between the two but worth checking if you have both installed.
For the benefit of searchers, this is the Powershell script I use to fix my local cluster. It was adapted from this issue fix on github.
#
# WARNING: YOU MUST STOP 'SERVICE FABRIC HOST SERVICE' IN SERVICES FIRST
# IF THE APPLICATION IS STUCK IN 'STARTING', RESTART YOUR MACHINE
#
# This script will completely reset the local cluster
#
Remove-Item 'C:\SfDevCluster' -Recurse -Force -ErrorAction Stop
New-Item -ItemType directory -Path 'C:\SfDevCluster'
Set-Location 'C:\Program Files\Microsoft SDKs\Service Fabric\ClusterSetup'
./DevClusterSetup.ps1 -PathToClusterDataRoot 'C:\SfDevCluster\Data' -PathToClusterLogRoot 'C:\SfDevCluster\Log'
C:\ drive was full for me. Easy thing to overlook.
Make sure your hard disks aren't full... that was stopping mine from starting. Immediately after clearing up some logs, starts up right away.
It seems like some cluster related settings have gone into an inconsistent state on your machine. This will require looking at Service Fabric traces and figure out the actual cause. I am an engineer on the Service Fabric team. I can help you out if you can email me the Service Fabric traces (from logs folder) at harahma[at]microsoft[dot]com.
If you are familiar with logging support tickets on Azure, I would suggest you do that too so we can track this issue to resolution. In the meantime I will continue to work on this to see how we can unblock you.
I know this is an old and question, but maybe my pain can help someone else out.
You'll get a similar error if the Windows Firewall service is not running when Service Fabric attempts to start.
Check and make sure that the Windows Firewall service is set for Automatic and is running.
I have tried multiple options to resolve this issue like
Uninstall runtime and SDK - Reinstall it.
Removed cluster using powershell commands and setup using the same
and there are couple of more
BUT unfortunately none of them worked for me
Then finally I have Uninstalled Docker Desktop and suddenly issue got resolved.
This is very strange and not sure how docker desktop is obstackle for running FabricHostSvc Service.

Installing a Windows Service - No error but it isn't in Service Control Manager

I've created a windows service in c# and I'm trying to install it for debug using the installutil as recommended here: http://msdn.microsoft.com/en-us/library/sd8zc8ha.aspx
The installutil says Install completed. However, nothing appears in the service control manager.
I've tried this on Server 2008 and XP with the same result.
Any ideas?
A colleague of mine had a more or less identical problem.
Did you add an installer to your project? For the service to be installed you need to add an installer to your Visual Studio Project.
The easiest way to add an installer in Visual Studio is to open your service in Design Mode and right click the design area and select Add Installer. This will add a file ProjectInstaller.cs with itself contains a ServiceInstaller object and a ServiceProcessInstaller object.
With the installer added you can set the Service Name, Description and other options that will be used when installing the service. If you now try to use InstallUtil your service should be installed and should show up in the Services list.
I had a similar issue (build installer, no errors, no service appears in services.msc) but a different solution, as I had configured the installers.
In my case, the Service-project's Application Properties (Alt-Enter, Application-tab) Startup object was (not set) as shown below:
Picking the default .Program and rebuilding service and installer worked (service appeared in services.msc).
Setting this property is one of the steps in the MSDN service installer walkthrough referenced in this SO answer. Make sure to follow all of the steps!
I can't speak specifically to any issues that are the fault of C# or .NET, but I have a writeup of what has to happen for a service to be installed and work in the form of an extensively documented framework (source code included) for writing services in Lua. I offer it up here as an example of another way to do it, because sometimes just seeing things from another point of view can be helpful.
Disclaimer: It is very much at an alpha quality level, and yes, I am its author.
The framework has all the code needed to interact with the Windows SCM to install and remove the service.

Categories

Resources