Skip to content

ASP.net 5 404 error when hosting as an application inside website #1260

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

Closed
raymak23 opened this issue Jan 26, 2016 · 10 comments
Closed

ASP.net 5 404 error when hosting as an application inside website #1260

raymak23 opened this issue Jan 26, 2016 · 10 comments
Labels
✔️ Resolution: Duplicate Resolved as a duplicate of another issue

Comments

@raymak23
Copy link

Hello,

There appears to be an issue hosting asp.net 5 mvc 6 application when hosting an application as an application inside website.

Below is screenshot contains my hosting environment. I have a ps application inside Admin website. When I browse http://localhost:8084/ps, I get 404 page in the browser.

image

Then I setup a new website called ps with port 8085 and configured it to point to application wwwroot path, and when I browse the URL http://localhost:8085/ I am able to see the landing page of the application.

@Tratcher Tratcher added the ✔️ Resolution: Duplicate Resolved as a duplicate of another issue label Jan 26, 2016
@Tratcher
Copy link
Member

See aspnet/IISIntegration#14

@javiercn
Copy link
Member

@Tratcher Can this be related to aspnet/Mvc#3769?

@Tratcher
Copy link
Member

@javiercn not for a normal browser request to the home page. It's probably aspnet/IISIntegration#14.

@raymak23
Copy link
Author

Thanks guys, I will give it a try.

@raymak23
Copy link
Author

So I followed along with comments and I found something that I thought would work. I added environment variable in web.config that is in wwwroot folder. Please see below config settings:

<httpPlatform processPath="..\approot\web.cmd" arguments="" stdoutLogEnabled="true" stdoutLogFile="..\logs\stdout.log" startupTimeLimit="3600">
        <environmentVariables>
            <environmentVariable name="HTTP_PLATFORM_APPL_PATH" value="/ps" />
        </environmentVariables>
</httpPlatform>

Then I recycled the app pool and performed IISREST, and when I browse the application localhost:8084/ps I still get 404 error.

In stdout.log file I see below log created:

Hosting environment: Production
Now listening on: http://localhost:19684
Application started. Press Ctrl+C to shut down.

I also checked httpPlatform

image

@Tratcher
Copy link
Member

Are you using the current RC2 packages described here? aspnet/IISIntegration#52 (comment)

@raymak23
Copy link
Author

Nope, I am using RC1. Please see below dependencies from project.json file.

"dependencies": {
    "Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
    "Microsoft.AspNet.Mvc.Core": "6.0.0-rc1-final",
    "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
    "Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
    "Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final",
    "Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-final",
    "Microsoft.Net.Http.Server": "1.0.0-beta5",
    "dnx-clr-win-x64": "1.0.0-rc1-update1",
    "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final"
  }

@Tratcher
Copy link
Member

The web.config workaround only applies to the latest RC2 packages. For RC1 you need to use the Map workaround: aspnet/IISIntegration#14 (comment)

@raymak23
Copy link
Author

Thanks @Tratcher. Since RC2 is not production ready yet. I will continue to use RC1. So I applied below settings in startup.cs file and now I am getting 500 error.

public void Configure(IApplicationBuilder app, ILoggerFactory LoggerFactory, IHostingEnvironment env)
        {
            app.Map("/ps", (app1) => this.Configure1(app1, env, LoggerFactory));
            LoggerFactory.AddDebug(LogLevel.Warning);
            app.UseIISPlatformHandler();
            app.UseStaticFiles();

            app.UseMvc(config =>
            {
                config.MapRoute(
                    name: "Default",
                    template: "{controller}/{action}/{id?}",
                    defaults: new { controller = "App", Action = "Index" }
                    );
            }); // Use MVC from Dependency.
        }

        private void Configure1(IApplicationBuilder app1, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {

        }
        } 

I also tried this as well:

public void Configure(IApplicationBuilder app, ILoggerFactory LoggerFactory, IHostingEnvironment 
env)
        {
            app.Map("/ps", (app1) => this.Configure(app1, env, LoggerFactory));
            LoggerFactory.AddDebug(LogLevel.Warning);
            app.UseIISPlatformHandler();
            app.UseStaticFiles();

            app.UseMvc(config =>
            {
                config.MapRoute(
                    name: "Default",
                    template: "{controller}/{action}/{id?}",
                    defaults: new { controller = "App", Action = "Index" }
                    );
            }); // Use MVC from Dependency.
        }

@Tratcher
Copy link
Member

        public void Configure(IApplicationBuilder app, ILoggerFactory LoggerFactory, IHostingEnvironment env)
        {
            app.Map("/ps", (app1) => this.Configure1(app1, env, LoggerFactory));
        }

        private void Configure1(IApplicationBuilder app1, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            LoggerFactory.AddDebug(LogLevel.Warning);
            app.UseIISPlatformHandler();
            app.UseStaticFiles();

            app.UseMvc(config =>
            {
                config.MapRoute(
                    name: "Default",
                    template: "{controller}/{action}/{id?}",
                    defaults: new { controller = "App", Action = "Index" }
                    );
            }); // Use MVC from Dependency.
        }

@raymak23 raymak23 closed this as completed Feb 6, 2016
jkotalik added a commit that referenced this issue Nov 1, 2018
@ghost ghost locked as resolved and limited conversation to collaborators Dec 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
✔️ Resolution: Duplicate Resolved as a duplicate of another issue
Projects
None yet
Development

No branches or pull requests

3 participants