While I was trying to port owin asp.net website to pi, (raspberry pi model), I ended up with a website displaying the error page:
Invalid request (invalid host)
On pi I run raspbian wheezy. I installed mono (version 3.2.8). For a simple console, the mono application works.
for the Owin site, I made a console project in visual studio 2015.
I added nuget packages to this console:
Microsoft.Owin
Microsoft.Owin.Diagnostics
Microsoft.Owin.Host.HttpListner
Microsoft.Owin.Hosting
After that, I added the Owin startup class. In this class, I added a few lines of code to display the current os ":public void Configuration(IAppBuilder app)
{
app.UseWelcomePage(new Microsoft.Owin.Diagnostics.WelcomePageOptions()
{
Path = new PathString("/welcome")
});
app.Run(context =>
{
context.Response.ContentType = "text/plain";
string output = string.Format(
"I'm running on {0} nFrom assembly {1}",
Environment.OSVersion,
System.Reflection.Assembly.GetEntryAssembly().FullName
);
return context.Response.WriteAsync(output);
});
}
Now I only needed to specify the base url of the project in the program class, id did this in the main function
string baseUrl = "http://localhost:5000";
using (WebApp.Start<Startup>(baseUrl))
{
Console.WriteLine("Press Enter to quit.");
Console.ReadKey();
}
"Enter", .
http://localhost:5000
- :
Microsoft Windows NT 6.2.9200.0 nFrom assembly ConsoleApplication1, Version = 1.0.0.0, Culture = , PublicKeyToken =
, dll exe pi
Mono ConsoleApplication1.exe
pi Enter, . ip pi 500,
http://192.168.7.137:5000/
- ( )