Results 1 to 4 of 4

Thread: cshtml files causing 404 on web site

  1. #1
    J Trahair is offline C# Forum Newbie
    .NET Framework
    .NET 4.0
    Join Date
    Jul 2012
    Posts
    2
    Rep Power
    0

    cshtml files causing 404 on web site

    Hi. I've done a tutorial in ASP.net, the pages have .cshtml extensions. It works fine using IIS on localhost - the pages show fine. I uploaded all files and folders correctly, but I get a 404.3:

    HTTP Error 404.3 - File or directory not found: MIME map policy prevents this request. Internet Information Services (IIS)

    My ISP says 'the hosting account is on Windows servers, the ASP.NET is version 4.'
    I attach a zip of the tutorial site. Try http://www.foreversoftware.co.uk/web.../Movies.cshtml
    I know that .cshtml files aren't normal .html files, but that's what the instructions for uploading said!
    What have I missed?
    Attached Files Attached Files

  2. #2
    JohnH's Avatar
    JohnH is offline C# Forum Moderator
    .NET Framework
    .NET 4.5
    Join Date
    Apr 2011
    Location
    Norway
    Posts
    333
    Rep Power
    88
    I would say they haven't installed MVC, this may help you iis6 - What exactly needs done to IIS 6 to serve cshtml pages? - Stack Overflow
    What I would look into if ISP won't update, from that thread:
    - Add Deployable Dependencies
    - web.config settings
    - MIME mappings

    I have deployed a Razor site myself, that webhost supported Razor right out of the box though. The account is inaccessible to me right now, so I can't check the existing IIS settings there.

  3. #3
    J Trahair is offline C# Forum Newbie
    .NET Framework
    .NET 4.0
    Join Date
    Jul 2012
    Posts
    2
    Rep Power
    0
    Thank you - I added the lines to web.config, still getting a 404. Waiting to hear from my ISP...

  4. #4
    JohnH's Avatar
    JohnH is offline C# Forum Moderator
    .NET Framework
    .NET 4.5
    Join Date
    Apr 2011
    Location
    Norway
    Posts
    333
    Rep Power
    88
    Here's a screenshot of the handler mappings for .cshtml, I didn't find any other IIS settings related to cshtml on that server.

    cshtml-handler-mappings.png

    If you don't have IIS remote admin access the equivalent web.config settings can be added like this: How to: Register HTTP Handlers

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •