简体   繁体   中英

Service Fabric Debugging

When I try to run SF service from VS in debug mode I get the following:

An attempt was made to upgrade the application but the application's version has not been changed. Be sure to update the version in the application manifest prior to upgrading.

Where I have to manually delete this service in SF explorer. Is there a way to skip this removing step somehow so that the service that is being debugged simply 'overwrites' old one?

You can attach the debugger to the deployed application processes. Go to Debug -> Attach to Process. You can choose multiple services. Note that Visual Studio needs to be running in Administrator mode.

If you want to debug a service's startup code, Use Debugger.Launch() . This method will block the calling code and prompt you to choose a debugger, you can choose a running instance of VS. Unfortunately, there is a bug and VS2017 does not appear as an option. Alternatively, You can call Thread.Sleep(<duration>) at startup and attach the debugger quickly, this last option always works.

It happens because the configuration for Application Debug Mode is not set correctly. The setting is probably set to keep the application in Service Fabric when you stop debugging, this way, after the first deployment, the application will stay running the old code deployed to SF.

Your other option is set it to either Remove Application or Refresh Application

For reference, your options are:

Application Debug Modes

  • Refresh Application This mode enables you to quickly change and debug your code and supports editing static web files while debugging. This mode only works if your local development cluster is in 1-Node mode. This is the default Application Debug Mode.
  • Remove Application causes the application to be removed when the debug session ends.
  • Auto Upgrade The application continues to run when the debug session ends. The next debug session will treat the deployment as an upgrade. The upgrade process preserves any data that you entered in a previous debug session.
  • Keep Application The application keeps running in the cluster when the debug session ends. At the beginning of the next debug session, the application will be removed.

This doc explains with more details.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM