【问题标题】:IIS server can not find index.aspx file - 404 errorIIS 服务器找不到 index.aspx 文件 - 404 错误
【发布时间】:2018-08-10 13:45:09
【问题描述】:

我正在使用 VS 2015(不是 MVC)在 asp.net 上开发一个 Web 应用程序。我选择了“Project”(不是网站)来创建应用程序。该应用程序在我的本地机器上运行良好。我已经发布了网站(使用按编译的文件系统)并将其上传到服务器空间。现在我得到了流动的错误:

找不到资源。

描述:HTTP 404。您要查找的资源(或其依赖项之一)可能已被删除、名称已更改或暂时不可用。请检查以下 URL 并确保其拼写正确。

请求的 URL:/Index.aspx

但是 index.aspx 文件在根目录下。我不知道为什么 IIS 找不到 index.aspx 文件。

web.config 文件中是否需要进行任何更改?有什么线索吗?

您可以在http://ssdm.xinksoft.com/找到该网站

谢谢

帕莎·萨拉蒂·查克拉博蒂

【问题讨论】:

  • 您是否尝试过请求此 URL:/Index
  • @Rafalon 你是对的。 /index 正在工作。但是用户只会在没有文件的情况下键入网站。我该如何解决这个问题...是否需要更改 RouteConfig 文件中的“settings.AutoRedirectMode”选项?

标签: c# asp.net iis visual-studio-2015 compiler-errors


【解决方案1】:

如果您查看错误消息的源代码,则会出现以下消息:

<!-- 
[FileNotFoundException]: Could not find file &#39;D:\INETPUB\VHOSTS\xinksoft.com\ssdm.xinksoft.com\bin\roslyn\csc.exe&#39;.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at Microsoft.CodeDom.Providers.DotNetCompilerPlatform.Compiler.get_CompilerName()
   at Microsoft.CodeDom.Providers.DotNetCompilerPlatform.Compiler.FromFileBatch(CompilerParameters options, String[] fileNames)
   at Microsoft.CodeDom.Providers.DotNetCompilerPlatform.Compiler.CompileAssemblyFromFileBatch(CompilerParameters options, String[] fileNames)
   at System.CodeDom.Compiler.CodeDomProvider.CompileAssemblyFromFile(CompilerParameters options, String[] fileNames)
   at System.Web.Compilation.AssemblyBuilder.Compile()
   at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
   at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
   at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
   at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
   at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean throwIfNotFound)
   at System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp)
   at System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath)
   at System.Web.UI.PageHandlerFactory.GetHandler(HttpContext context, String requestType, String virtualPath, String path)
   at System.Web.HttpApplication.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
[HttpException]: Exception of type &#39;System.Web.HttpException&#39; was thrown.
   at System.Web.HttpApplication.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
-->

所以,D:\INETPUB\VHOSTS\xinksoft.com\ssdm.xinksoft.com\bin\roslyn\csc.exe 的文件丢失了。也许你没有复制完整的 bin 文件夹?

【讨论】:

【解决方案2】:

在IIS管理器中,你可以指定你网站的默认文件,你声明index.aspx了吗?

【讨论】:

  • 是的。我做到了。但问题是存在的。
  • 就像 NineBerry 所问的那样,您是否复制了整个 bin 文件夹并且在服务器上安装了 .net 运行时(与项目相同的版本)?你用的是什么版本的 ASP.Net?
猜你喜欢
  • 2014-11-11
  • 2021-01-31
  • 2017-02-23
  • 1970-01-01
  • 2011-02-07
  • 2016-07-15
  • 1970-01-01
  • 1970-01-01
  • 2016-03-19
相关资源
最近更新 更多