【问题标题】:IIS Shadowcopy not copying xml fileIS Shadow Copy 不复制 xml 文件
【发布时间】:2016-03-08 19:47:57
【问题描述】:

Visual Studio 2015,x64 机器,使用本地 IIS 托管 MVC 5 应用程序。

我的应用程序需要一个 XML 文件(log4net 配置文件)。我已将文件设置为“内容”和“始终复制到输出目录”。这个文件复制到bin\debug目录就好了。

不幸的是,当浏览器发出任何请求时,我得到:

找不到文件C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\solvernode\e0f7ede5\23a22c5c\assembly\dl3\89db89ce\7f06f1f4_272ed101\ISAMSLog4Net.xml

调查那个目录,我发现除了一个依赖的 dll。

我有:
- 删除了 asp.net 临时目录文件。
- 删除了所有 bin/obj 文件夹
- 从应用程序池到 IIS,重新启动所有可见的内容。
- 重新启动
- 使用新的 MVC 5 模板项目从头开始重建站点。

我的盒子上有 .net 4、4.5、4.5.1、4.5.2 和 4.6,按顺序安装。

当然可以在这方面使用一些帮助。下面的完整堆栈跟踪:

[FileNotFoundException: Could not find file 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\solvernode\e0f7ede5\23a22c5c\assembly\dl3\89db89ce\7f06f1f4_272ed101\ISAMSLog4Net.xml'.]
System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +1346
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) +886
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) +164
System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize, Boolean checkHost) +177
System.IO.StreamReader..ctor(String path) +53
SolverSupport.Logging.GetLogFileNameFromLog4NetConfig(String log4NetConfigPath) in C:\Repos\ISAMS\SolverSupport\Logging.cs:53
SolverSupport.Logging.WireUpLogging() in C:\Repos\ISAMS\SolverSupport\Logging.cs:16
StressCheckSolver.Solver.Init() in C:\Repos\ISAMS\StressCheckSolver\Solver.cs:20
I2ES.SolverNode.SolverLauncher.SolverLauncher.LaunchStressCheckSolver(Int32 jobId, Action`2 completedCallback) in C:\repos\ISAMS\I2ES\SolverNode\SolverLauncher\SolverLauncher.cs:41
I2ES.SolverNode.Controllers.SolverController.Submit(Int32 id) in C:\repos\ISAMS\I2ES\SolverNode\Controllers\SolverController.cs:15
lambda_method(Closure , ControllerBase , Object[] ) +141
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +229
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +35
System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +39
System.Web.Mvc.Async.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult) +67
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +42
System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d() +72
System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +386
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +42
System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +38
System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +186
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +38
System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +29
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +65
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +53
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +36
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +38
System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +44
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +65
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +38
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +399
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +157

【问题讨论】:

  • 感谢编辑。
  • 原来是 PEBKAC(键盘和椅子之间存在问题。)子库错误地直接调用 Log4Net 而不是通过框架。它正在寻找一个 IIS 从未被告知要复制的 xml 文件。

标签: c# asp.net .net asp.net-mvc asp.net-mvc-5


【解决方案1】:

您如何尝试从 SolverSupport.Logging.GetLogFileNameFromLog4NetConfig 方法中加载 XML 文件?您似乎错误地引用了文件夹位置。

【讨论】:

    猜你喜欢
    • 2014-06-13
    • 1970-01-01
    • 1970-01-01
    • 2016-07-17
    • 2021-03-22
    • 1970-01-01
    • 2018-05-27
    • 2019-09-01
    • 1970-01-01
    相关资源
    最近更新 更多