locked
MVC 5 app using VS 2017 - getting page not found error when trying to publish RRS feed

  • Question

  • User-2006371901 posted

    I'm trying to publish a simple CRUD application via ftp method thru my webhost, it is MVC5 version . I did all the necessary configuration thru the webhost control panel with integrating WebDeploy for my domain in question, using a Default Doc that the host suggests. The project published successfully  when creating the Publishing Profile inside VS 2017 (community edition); when trying to view my project live, i get 404 Resource Not Found . Checked my project files, decided to make index.cshml as the Start page (i'm new to MVC 5 , so not sure if this is what to do) , but still I get the 404 error when trying to view the application live.
    ????
    tia
    Nork

    Sunday, December 17, 2017 6:47 PM

All replies

  • User991499041 posted

    Hi Nork,

    I'm trying to publish a simple CRUD application via ftp method thru my webhost, it is MVC5 version . I did all the necessary configuration thru the webhost control panel with integrating WebDeploy for my domain in question, using a Default Doc that the host suggests. The project published successfully  when creating the Publishing Profile inside VS 2017 (community edition); when trying to view my project live, i get 404 Resource Not Found . Checked my project files, decided to make index.cshml as the Start page (i'm new to MVC 5 , so not sure if this is what to do) , but still I get the 404 error when trying to view the application live.

    Apparently this can have many different causes.

    Try addinf the following to system.webServer in web.config:

    <modules runAllManagedModulesForAllRequests="true"/>

    Checkout if KB 2023146 applies to your scenario. Also try requesting directly a controller action: /yoursitename/controllerName/actionName

    Also try https://stackoverflow.com/a/5155322

    Regards,

    zxj

    Monday, December 18, 2017 1:52 AM
  • User-2006371901 posted

    Thanks for your reply; none of these suggestions work. My routes setup in the Application_Start function (inside global.asax) looks like this:

    namespace myproject

    {

        public class MvcApplication : System.Web.HttpApplication

        {

            protected void Application_Start()

            {

                AreaRegistration.RegisterAllAreas();

                RouteConfig.RegisterRoutes(RouteTable.Routes);

            }

        }

    }

    ???

    Nork

    Tuesday, December 19, 2017 5:17 PM
  • User409696431 posted

    And what does the RouteConfig.cs file look like? (And/or are you using attribute routing?  https://blogs.msdn.microsoft.com/webdev/2013/10/17/attribute-routing-in-asp-net-mvc-5/)

    Tuesday, December 19, 2017 7:05 PM
  • User-2006371901 posted

    Thanks for reply, I'm simply trying to get the application to display live (vs. 404  when I know the project/solution published successfully in Visual Studio 2017) 

    namespace myproject

    {

        public class RouteConfig

        {

            public static void RegisterRoutes(RouteCollection routes)

            {

                routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

                routes.MapRoute(

                    name: "Default",

                    url: "{controller}/{action}/{id}",

                    defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }

                );

            }

        }

    }

    Tuesday, December 19, 2017 8:16 PM
  • User475983607 posted

    Have you tried contacting your hosting provider for assistance?  I would start there first.

    What is the URL you are trying to hit?  Have you tried dropping an index.html page on the site root and navigating to the index page?  Have you verified the bin folder has your app dll and any assembly references that your app needs?  Is you web.config in the root?  Do you have a Views folder?  Does your site use authentication.

    Tuesday, December 19, 2017 8:48 PM
  • User-2006371901 posted

    The only help hosting could provide was directing me to WebDeploy for the domain/site in question. The url of the page I need to see when first coming to the site is ~/Views/_Userdetails/index.cshtml. Putting an index.html into the root pointing to the index.cshtml still renders 404. The bin has all the dlls including the roslyn folder. Web.config is in the root. Has a Views folder, doesnt use authentication.

    routeconfig.cs config setup (which right now is the default):

    namespace myproject

    {

        public class RouteConfig

        {

            public static void RegisterRoutes(RouteCollection routes)

            {

                routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

                routes.MapRoute(

                    name: "Default",

                    url: "{controller}/{action}/{id}",

                    defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }

                );

            }

        }

    }
    HTH

    Nork

    Wednesday, December 20, 2017 1:58 AM
  • User475983607 posted
    No, the root of your site is your domain. The URL you are showing is a path to a view which is not how MVC works. Just enter the domain you registerd with your hosting provider.
    Wednesday, December 20, 2017 2:22 AM
  • User-2006371901 posted

    I'm not trying to publish this in my domain proper ; I have to publish it in a subdomain because I have other non-related application in www.mymaindomain.com ; i'm trying to publish this in sub.mymaindomain.com , if that makes sense.
    Nork

    Wednesday, December 20, 2017 4:55 PM
  • User475983607 posted

    I'm not trying to publish this in my domain proper ; I have to publish it in a subdomain because I have other non-related application in www.mymaindomain.com ; i'm trying to publish this in sub.mymaindomain.com , if that makes sense.
    Nork

    If you have properly configured the sub domain, the subdomain DNS has propagated, and the MVC app is properly deployed to the sub domain then simply enter the subdomain address in your address bar and the MVC app should start up invoking the default route.

    If this does not work then you need to troubleshoot.  The first thing I would do is remove the MVC app completely and drop an index.html file that contain "Hello World!" on the root of the subdomain Once again enter the subdomain address in your browser and you should see Hello World!.  If you do not see Hello World, then contact your hosting provider for assistance setting up the subdomain.

    That does not change the fact that accessing the View directory in MVC 5 is not allowed due to the default configuration.  MVC URLs are controller actions not views.

    Wednesday, December 20, 2017 5:13 PM