Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6073141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:14:17+00:00 2026-05-23T10:14:17+00:00

I am trying to use Nancy (using the Self Hosting with Razor views nuget

  • 0

I am trying to use Nancy (using the Self Hosting with Razor views nuget packages) inside of a Topshelf service. I am hosting it on http://localhost:8585/, and it works just fine while I’m in debug mode or call my executable directly. The Nancy module serves up a razor view perfectly.

I then install the application:

myapp.exe install

When I start the service, it seems to be working just fine, and there are no errors. Then, when I go to http://localhost:8585/ in the browser I get a blank response. Any ideas as to why?

Before I start hosting the service with Topshelf, I start up Nancy:

_nancyHost = new NancyHost(_baseUri);
_nancyHost.Start();

After that, the topshelf service is configured and started like this:

using (Container)
{
    var host = HostFactory.New(config =>
    {
        config.EnableDashboard();
        config.AfterStartingServices(() => Console.WriteLine("Done starting..."));
        config.Service<EventHandlerService>(s =>
        {
            s.SetServiceName("EventHandlerService");
            s.ConstructUsing(c => Container.Get<EventHandlerService>());
            s.WhenStarted(n => StartService(n, stopwatch));
            s.WhenStopped(n => StopService(n, stopwatch));
        });
        config.RunAsLocalSystem();
        config.SetDescription("A service for processing events.");
        config.SetDisplayName("EventHandlerService");
        config.SetInstanceName("EventHandlerService");
        config.SetServiceName("EventHandlerService");
    });
    host.Run();
}

I am using ninject, and the StartService and StopService methods are just functions that print the current value of stopwatch.ElapsedMilliseconds.

Here’s the configuration of my Nancy module:

Get["/"] = parameters =>
{
    var indexViewModel = new IndexViewModel { CurrentDateTime = DateTime.Now, WorkLog = _service.WorkLog };

    return View["index", indexViewModel];
};

Get["/js/{file}"] = p =>
{
    return Response.AsJs("scripts/" + p.file as String);
};

Get["/style/{file}"] = p =>
{
    return Response.AsCss("content/themes/base/" + p.file as String);
};

Get["/img/{file}"] = p =>
{
    return Response.AsImage("content/themes/base/images/" + p.file as String);
};

I’m using all of the defaults in Nancy, other than the Self Hosting & Razor parts. Any idea what might be going on?

I also tried netsh http add urlacl url=http://+:8585/ user=\Everyone and it didn’t seem to have any affect on the behavior.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T10:14:18+00:00Added an answer on May 23, 2026 at 10:14 am

    I’d hazard a guess at it being a root path problem so it can’t find your view (assuming the views are being copied). I’ve no idea how TopShelf works – does it set the working directory to the directory of the app it’s launching? By default the root path will be set to “Environment.CurrentDirectory” which may or may not be correct.

    If using CurrentDirectory isn’t feasible then you can either switch to embedded views (example on how to do that in the main solution), or add an implementation of IRootPathProvider to your project and return the assembly location instead (it will automatically pickup your version over the default)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying use self-signed certificate (c#): X509Certificate2 cert = new X509Certificate2( Server.MapPath(~/App_Data/myhost.pfx), pass); on
I'm trying use mod_rewrite to rewrite URLs from the following: http://www.site.com/one-two-file.php to http://www.site.com/one/two/file.php The
Trying to use this method (gist of which is use self.method_name in the FunnyHelper
trying to use regex to replace any white space with &nbsp;, inside of example
I am trying use MySql and Entity Framework, using Connector/Net 6.1 with this as
Anyone know how to create a cvCreateStructuringElementEx using a image? I'm trying use opencv.cv.cvCreateStructuringElementEx()
I'm trying use make a div's background transparent using a mixture of CSS3 rgba()
I've been trying to use this plugin -> http://code.drewwilson.com/entry/autosuggest-jquery-plugin (broken link, see github ),
I was trying use a set of filter functions to run the appropriate routine,
I am trying use a Java Uploader in a ROR app (for its ease

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.