Skip to content

Instantly share code, notes, and snippets.

@jchannon
Created August 5, 2015 13:59
Show Gist options
  • Save jchannon/8c9dd82fb6a173fb002a to your computer and use it in GitHub Desktop.
Save jchannon/8c9dd82fb6a173fb002a to your computer and use it in GitHub Desktop.
RootpathProvider for Nancy when Hosting is separated
public static class AssemblyExtensions
{
public static string GetExecutionPath()
{
var codeBase = Assembly.GetExecutingAssembly().CodeBase;
var uri = new Uri(codeBase);
var path = uri.LocalPath;
var root = Path.GetDirectoryName(path);
return root;
}
}
protected override IRootPathProvider RootPathProvider
{
get { return new MyRootPathProvider(); }
}
public class VQRootPathProvider : IRootPathProvider
{
public string GetRootPath()
{
return AssemblyExtensions.GetExecutionPath();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment