Skip to content
Demis Bellot edited this page Mar 27, 2014 · 5 revisions

Debugging Source Symbols in NuGet packages

It's possible to debug into the ServiceStack source code when using the ServiceStack NuGet packages. You can enable this after enabling SymbolSource integration in VisualStudio:

  1. Go to Tools -> Options -> Debugger -> General
  2. Uncheck Enable Just My Code, Enable .NET Framework source stepping and Require source files to exactly match the original version
  3. Check Enable source server support
  4. In the Tools -> Options -> Debugger -> Symbols dialog, under the Symbol file (.pdb) locations section by clicking the New Folder icon and add the following urls (in order): - http://referencesource.microsoft.com/symbols - http://srv.symbolsource.org/pdb/Public - http://srv.symbolsource.org/pdb/MyGet - http://msdl.microsoft.com/download/symbols

And with that you should now be able to debug into the source code of any NuGet package (who publishes their Symbols) directly from within your application!

Configuration

DebugMode

ServiceStack allows additional debug information when in DebugMode, which is automatically set by default in Debug builds or explicitly with:

SetConfig(new HostConfig { DebugMode = true });

In addition, users with the Admin role or Requests with an AuthSecret can also view Debug Info in production.

Admin Role

Users in the Admin role have super-user access giving them access to any services or plugins protected with Roles and Permissions.

AuthSecret

You can use Config.AdminAuthSecret to specify a special string to give you admin access without having to login by adding ?authsecret=xxx to the query string, e.g:

SetConfig(new HostConfig { AdminAuthSecret = "secretz" });

By-pass protected services using query string:

/my-service?authsecret=secretz

Debug Links

To provide better visibility to the hidden functionality in ServiceStack we've added Debug Info links section to the /metadata page which add links to any Plugins with Web UI's, e.g:

Debug Info Links

The Debug Links section is only available in DebugMode.

You can add links to your own Plugins in the metadata pages with:

appHost.GetPlugin<MetadataFeature>()
    .AddPluginLink("swagger-ui/", "Swagger UI");

appHost.GetPlugin<MetadataFeature>()
    .AddDebugLink("?debug=requestinfo", "Request Info");

AddPluginLink adds links under the Plugin Links section and should be used if your plugin is publicly visible, otherwise use AddDebugLink for plugins only available during debugging or development.

Plugins

There are a number of plugins that can help with debugging:

Request Info

Provides ServiceStack's Request Info feature useful for debugging requests. Just add ?debug=requestinfo in your /pathinfo and ServiceStack will return a dump of all the HTTP Request parameters to help with with debugging interoperability issues. The RequestInfoFeature is only enabled in DebugMode.

var feature = Plugins.FirstOrDefault(x => x is RequestInfoFeature); 
Plugins.RemoveAll(x => x is RequestInfoFeature); 

Add an In-Memory IRequestLogger and service with the default route at /requestlogs which maintains a live log of the most recent requests (and their responses). Supports multiple config options incl. Rolling-size capacity, error and session tracking, hidden request bodies for sensitive services, etc.

Plugins.Add(new RequestLogsFeature());

The IRequestLogger is a great way to introspect and analyze your service requests in real-time. Here's a screenshot from the http://bootstrapapi.apphb.com website:

Live Screenshot

It supports multiple queryString filters and switches so you filter out related requests for better analysis and debuggability:

Request Logs Usage

The RequestLogsService is just a simple C# service under-the-hood but is a good example of how a little bit of code can provide a lot of value in ServiceStack's by leveraging its generic, built-in features.



  1. Getting Started
    1. Create your first webservice
    2. Your first webservice explained
    3. ServiceStack's new API Design
    4. Designing a REST-ful service with ServiceStack
    5. Example Projects Overview
  2. Reference
    1. Order of Operations
    2. The IoC container
    3. Metadata page
    4. Rest, SOAP & default endpoints
    5. SOAP support
    6. Routing
    7. Service return types
    8. Customize HTTP Responses
    9. Plugins
    10. Validation
    11. Error Handling
    12. Security
    13. Debugging
  3. Clients
    1. Overview
    2. C# client
    3. Silverlight client
    4. JavaScript client
    5. Dart Client
    6. MQ Clients
  4. Formats
    1. Overview
    2. JSON/JSV and XML
    3. ServiceStack's new HTML5 Report Format
    4. ServiceStack's new CSV Format
    5. MessagePack Format
    6. ProtoBuf Format
  5. View Engines 4. Razor & Markdown Razor
    1. Markdown Razor
  6. Hosts
    1. IIS
    2. Self-hosting
    3. Messaging
    4. Mono
  7. Security
    1. Authentication/authorization
    2. Sessions
    3. Restricting Services
  8. Advanced
    1. Configuration options
    2. Access HTTP specific features in services
    3. Logging
    4. Serialization/deserialization
    5. Request/response filters
    6. Filter attributes
    7. Concurrency Model
    8. Built-in caching options
    9. Built-in profiling
    10. Form Hijacking Prevention
    11. Auto-Mapping
    12. HTTP Utils
    13. Virtual File System
    14. Config API
    15. Physical Project Structure
    16. Modularizing Services
    17. MVC Integration
  9. Plugins 3. Request logger 4. Swagger API
  10. Tests
    1. Testing
    2. HowTo write unit/integration tests
  11. Other Languages
    1. FSharp
    2. VB.NET
  12. Use Cases
    1. Single Page Apps
    2. Azure
    3. Logging
    4. Bundling and Minification
    5. NHibernate
  13. Performance
    1. Real world performance
  14. How To
    1. Sending stream to ServiceStack
    2. Setting UserAgent in ServiceStack JsonServiceClient
    3. ServiceStack adding to allowed file extensions
    4. Default web service page how to
  15. Future
    1. Roadmap

Clone this wiki locally