Rails 4.0.0.beta ActionController::RoutingError (No route matches [GET] "/"): - rails-routing

I've created simple rails app. In development mode i'd got typical "Welcome page" but in production mode had error ActionController::RoutingError (No route matches [GET] "/") until created controller and set root route. Why i can't see "Welcome page" in production?

The welcomes controller is only for development. Here is the pull request that added it stating that it only works in the development environment:
https://github.com/rails/rails/pull/8468

Related

Problems deploying a mixed asp.net-core/ SPA application to IIS

Deploying my web app, I can't get my apis working. Everything works fine in development on my machine.
I have an SPA front and a asp.net back. I hit publish and I get the following folder structure.
publish
|-MyProj.dll
|-MyProj.exe
|-web.config
|-wwwroot
|-assets
|-all my spa.js
|-index.html
I deploy all of that into the root of a new IIS application underneath Default Web Site.
When I browse to http://my-server/MyAppName/, my spa index.html is served, and that side is all fine. However, when the spa starts emitting api requests to http://my-server/MyAppName/api/some-route, the route is not resolved and IIS defaults to returning my index.html.
In my controllers, I use attribute routing... [Route("api/some-route")]. Just to test, I tried modifying a route attribute to [Route("MyAppName/api/some-route")] but I still get index.html. I know my Startup.cs is being processed because if I rename index.html in the code below, everything breaks and I don't see my spa anymore...
// Startup.cs
app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute(
name: "default",
pattern: "api/{controller}/{action=Index}/{id?}");
endpoints.MapFallbackToFile("index.html");
});
What do I need to configure to tell my app that it's in a virtual dir, and that requests to virtual-dir/api are to be served by asp ??????

Routing Template results in a 404 when navigating to English /en/ site

I have one basic routing template on my newly created project (.NET Core 2.2) (below).
routes.MapRoute(
name: "default",
template: "{parameter}/{controller}/{action}/{id?}"
);
If I try to go to localhost:5000/en/default/index it is not working (I get a 404). Something except "en" is working properly like localhost:5000/abc/default/index or localhost:5000/xyz/default/index.
Why is this happening? How can I fix it?
When I try to run my web app on IIS Express, it automatically adds configuration to applicationhost.config which is located at {SolutionFolder}\\.vs\\{SolutionName}\\config\\applicationhost.config. And it has virtual directories starting with "/en/". I don't know why IIS Express adds this virtual directories but that was the actual redirection problem.

ASP.NET Friendly URLs 404 errors on IIS Application

I'm using ASP.NET Friendly URLs in my web application project.
It works without any problem, but when I use IIS and Create Application under my default web site I get 404 error.
For example I have a page with URL address like this:
localhost/home/default.aspx
and I rewrite it to this address:
localhost/home/
with this line in routeconfig.cs:
routes.MapPageRoute("home", "home", "~/home/Default.aspx")
I refer to this new URL in my link by href="/home" and as I said it works ok until I use the application under IIS.
I created the application under my default web site in IIS with name APP1 and when I click on link with href="/home" my page address must be localhost/APP1/home but the address in address bar changes to localhost/home and I get 404 error.
Could you help me solve this problem?
The home page will not be localhost/app1/home - that's not how it works.
1 - Create an entry in your hosts file: -
127.0.0.1 app1
2 - Create a new website in IIS, pointing at the root folder of your website. Make sure you enter 'app1' into the 'Host name' field: -
3 - The home page of your new site is http://app1/home

Cannot find Account/Authorize when MVC Web App

I have an MVC app having the following default routing map:
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new {controller = "Startup", action = "Index", id = UrlParameter.Optional }
);
As long as I deploy this site to the root of my IIS server (c:\inetpub\wwwroot) and create a new website within IIS, everything works just fine.
However if I create a directory within the wwwroot folder structure, deploy the same files there and instead of creating a website, I create an Application underneath the DefaultWebSite and point it to the subfolder where the files reside (c:\inetpub\wwwroot\MyApplication); when I launch the WebApplication that previous was configured as a website, I get the error "The resource you are looking for has been removed, had its name changed, or is temporarily unavailable."
Requested URL: http://localhost:80/Account/Authorize?client_id=web&response_type=token&state=
Physical Path: C:\inetpub\wwwroot\Account\Authorize
So it would appear that my routing needs to be adjusted to reflect the location of the app is in a subdirectory under wwwroot and not in wwwroot where it is looking.
What provisions should be taken to ensure an MVC Web "Application" runs properly under a Parent website?
=================================
UPDATED OBSERVATIONS
After considering a posted comment, I found a few more details of my issue may be noteworthy to mention.
My application is redirecting to the requested URL I posted by default, I am not doing it. In other words, if I open IIS, right-click my application under the DefaultWebSite and select browse; I am getting the incorrect URL. I don't ever recall having this issue with ASP.NET applications which suggests to me "routing" problem
If I alter the URL so that the Application Name precedes the Account/Authorize path I get redirected again to http://localhost/#access_token=&token_type=bearer&expires_in=1209600 and receive a blank content page that says "Beginning Execution" in the upper right hand corner. The title of the page says CORS Detection Script. Suggesting to me that my application possibly resides in a different domain that the default website??? Need some clarity on this though.
If I again precede the URL that landed me on the CORS Detection Script page with the Application Name, my page successfully loads as I'd expect
================================================
So again, I believe there are some adjustments required somewhere within my app (probably within the routing configuration) to compensate for the incorrect URL being generated by default.
Because if I setup the application as a website with all content at the root instead of a subdirectory, everything works.
Surely someone has seen this before
When you're creating an application in a subfolder of your website, you're effectively only changing the scope of the process running your app (w3p.exe). You will still need to put the application name in the url, like this:
http://localhost:80/MyApplication/Account/Authorize?etc

visual studio 2013 http error 404, url rewritten

my solution has been working fine up until today, and most of it still works except for a single page, which is a default.aspx page. I get a "HTTP Error 404.0 - Not Found".
The URL has been rewritten from '~/Staff/Default.aspx', to '~/Staff/Default', and I have no idea why. If I retype in the '.aspx' on the end, it still gets taken off.
Detailed Error information:
Module: IIS Web Core,
Notification: MapRequestHandler ,
Handler: StaticFile,
Error Code: 0x80070002,
Requested URL: http://localhost:50742/Staff/Default,
Physical Path: C:\Users\Me\Documents\Visual Studio 2013\Projects\etc\etc\Staff\Default,
Logon Method: Negotiate
Other pages work, e.g. '~/Booking/Default.aspx' works fine, as do other similar directories with default pages in, but not this one. I don't have routing or any rewrites set up, and yesterday I had it working.
Any ideas?
thanks

Resources