All routes not found on MacOS
See original GitHub issueHi, I’m make an app work fine on Windows. But on MacBook display “Not found (Not found)” any route. Here is my code: ` static HttpRequestService request; static void Main(string[] args) { Server s = new Server(“127.0.0.1”, 19000, false, DefaultRoute);
s.Routes.Static.Add(WatsonWebserver.HttpMethod.GET, "/app.js", async (ctx) => {
ctx.Response.ContentType = "application/javascript; charset=utf-8";
await ctx.Response.Send(Properties.Resources.app);
});
s.Routes.Static.Add(WatsonWebserver.HttpMethod.GET, "/app.css", async (ctx) => {
ctx.Response.ContentType = "text/css; charset=utf-8";
await ctx.Response.Send(Properties.Resources.app1);
});
s.Routes.Static.Add(WatsonWebserver.HttpMethod.GET, "/logo.png", async (ctx) => {
ctx.Response.ContentType = "image/png";
await ctx.Response.Send(Properties.Resources.logo);
});
s.Routes.Static.Add(WatsonWebserver.HttpMethod.GET, "/login", AuthorizeAsync);
s.Start();
Console.WriteLine("Press ENTER to exit");
Console.ReadLine();
}
private static async Task AuthorizeAsync(HttpContext ctx)
{
var login = new Login(request);
try
{
var l = await login.GetLogin();
ctx.Response.StatusCode = 200;
ctx.Response.ContentType = "application/json; charset=utf-8";
await ctx.Response.Send(l.ToJson());
return;
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
static async Task DefaultRoute(HttpContext ctx)
{
ctx.Response.StatusCode = 200;
ctx.Response.ContentType = "text/html; charset=utf-8";
await ctx.Response.Send(Properties.Resources.index);
return;
}`
Thanks!
I’m using .Net 5.0
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Unable to establish a route in Monterey.
The command appears to be accepted when entered on a terminal window, but the route/device can not be accessed via Safari.
Read more >How to reload default Mac OSX routing table without ...
I think that step 1 is route flush (to remove all routes). And step 2 needs to reload all of the default routes....
Read more >Apple MacOS appears to ignore default route assigned ...
All types of network traffic to non-local destinations fail (ping, web, ssh). And wireshark running on the MacBook shows the expected ARP and...
Read more >n` into the Mac terminal, why doesn't it show a routing table ...
When I typed it into the terminal on a Mac, it returned the following: usage: route [-dnqtv] command [[modifiers] args].
Read more >Getting "no route to host"in Mac OS X 10.5.8
If there is no default gateway, or the gateway has no information in its routing table to forward the packets, you'll see "no...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Good to know! Operating systems are sensitive to cases where the listener prefix (ie 127.0.0.1) is compared to the value in the incoming request’s HOST header.
@jchristn Thanks you for supported!
My problem solved when I changed
127.0.0.1
tolocalhost
. It is the difference on my code andTest.Default
Thanks you very much!