Вопрос

I recently deployed an ASP.NET MVC application on a Win server 2008, IIS 7 machine. It has MVC installed, and .NET framework 4.5 installed. Whenever I publish, and try to log in, I get this annoying error:

404 - File or directory not found.
The resource you are looking for might have been removed, had its name changed, or is     temporarily unavailable.

Meanwhile the controller action - Home/Login is intact and the Login.cshtml page is okay. Plus the web config file has

  modules runAllManagedModulesForAllRequests="true"/>
  compilation debug="true" targetFramework="4.5">
  assemblies>
     handlers>
    remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit"/>
    remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit"/>
    remove name="ExtensionlessUrlHandler-Integrated-4.0"/>
    add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule"  
    /handlers>

So I am wondering what is wrong. It is running under Integrated mode, ASP.NET 4.0 app pool. Static content and dynamic content are both enabled. I guess you can tell I have gone through most of the posts on this issue.:) Thanks in advance for the answer.

Это было полезно?

Решение

If possible, I would log onto the server that is hosting the application, Open IIS Manager, find your site and click view in browser. This will ensure that you have the URL correct and should give you more debugging information if something is going wrong.

Другие советы

You might have to add MIME Types if your files have nonstandard extensions.

Fair choices:

application/octet-stream
text/plain 

Without an associated MIME type, IIS just says 404 when you try and download a file which you can clearly see in the directory listing.

I have added below MIME types to web.config under system.webserver, and it's working

<urlCompression doStaticCompression="true" doDynamicCompression="true" />
    <httpCompression>
      <dynamicTypes>
        <clear />
        <add enabled="true" mimeType="text/*" />
        <add enabled="true" mimeType="message/*" />
        <add enabled="true" mimeType="application/x-javascript" />
        <add enabled="true" mimeType="application/javascript" />
        <add enabled="true" mimeType="application/json" />
        <add enabled="false" mimeType="*/*" />
        <add enabled="true" mimeType="application/atom+xml" />
        <add enabled="true" mimeType="application/atom+xml;charset=utf-8" />
      </dynamicTypes>
      <staticTypes>
        <clear />
        <add enabled="true" mimeType="text/*" />
        <add enabled="true" mimeType="message/*" />
        <add enabled="true" mimeType="application/javascript" />
        <add enabled="true" mimeType="application/atom+xml" />
        <add enabled="true" mimeType="application/xaml+xml" />
        <add enabled="true" mimeType="application/json" />
        <add enabled="false" mimeType="*/*" />
      </staticTypes>
    </httpCompression>
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top