Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with MVC application #61

Closed
ErcinDedeoglu opened this issue Jan 23, 2017 · 4 comments
Closed

Problem with MVC application #61

ErcinDedeoglu opened this issue Jan 23, 2017 · 4 comments

Comments

@ErcinDedeoglu
Copy link

I have a mvc website and i would like to embed it with embedio...
I tried above code but no luck.

screenshot_4

Unosquare.Labs.EmbedIO.WebServer server = new Unosquare.Labs.EmbedIO.WebServer(port, new Unosquare.Labs.EmbedIO.Log.SimpleConsoleLog());
server.RegisterModule(new Unosquare.Labs.EmbedIO.Modules.LocalSessionModule());
server.RegisterModule(new Unosquare.Labs.EmbedIO.Modules.StaticFilesModule(path));
server.Module<Unosquare.Labs.EmbedIO.Modules.StaticFilesModule>().UseRamCache = true;
server.RunAsync();
@geoperez
Copy link
Member

geoperez commented Jan 23, 2017 via email

@ErcinDedeoglu
Copy link
Author

hi @geoperez , could you give me an example? How to setup routes?

@geoperez
Copy link
Member

You need to check the following sample from https://github.com/unosquare/embedio-extras:

public class Program
{
    /// <summary>
    /// Entry point
    /// </summary>
    /// <param name="args"></param>
    private static void Main(string[] args)
    {
        // UseOwin() function returns Owin App for configuration
        using (var webServer = WebServer
                    .Create("http://localhost:4578")
                    .WithWebApi(typeof (PeopleController).Assembly)
                    .UseOwin((owinApp) => 
                        owinApp
                        .UseDirectoryBrowser()
                        .UseRazor(InitRoutes)))
                {
                    webServer.RunAsync();
                    Console.ReadKey();
                }
    }

    /// <summary>
    /// Initialize the Razor files
    /// </summary>
    /// <param name="table"></param>
    public static void InitRoutes(IRouteTable table)
    {
        table
            .AddFileRoute("/about/me", "Views/about.cshtml", new { Name = "EmbedIO Razor", Date = DateTime.UtcNow });
    }
}

Where the Extension Method UseOwin give you access to the IAppBuilder to setup the routes.

Again, this is a experimental extension and EmbedIO is not focus on support OWIN.

@geoperez
Copy link
Member

geoperez commented Feb 6, 2017

Closig ticket.

@geoperez geoperez closed this as completed Feb 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants