gpt4 book ai didi

c# - IIS 7.5 上经典 ASP 中 WshShell.Exec 的 System.IO.FileLoadException

转载 作者:行者123 更新时间:2023-11-30 18:30:25 25 4
gpt4 key购买 nike

我正在使用 DidiSoft OpenPGP for .NET 库将 C# 编译成由经典 ASP 执行的 exe。目标是更新此遗留网站的安全性以使用 PGP。这是一个旧站点,因此我们无法在不付出高昂成本的情况下重写它。

我尝试使用这个库的原因是当我们调用引用的已编译 C# EXE 时:

using System.Security.Cryptography;

我会在 ASP 中得到一个空白输出,而 IIS 会在事件日志中抛出一个类似这样的错误:

Faulting application name: PGPTest.exe, version: 1.0.0.51, time stamp: 0x52f28ee5 
Faulting module name: KERNELBASE.dll, version: 6.1.7601.18229, time stamp: 0x51fb1116
Exception code: 0xe0434352
Fault offset: 0x0000c41f
Faulting process id: 0x5f08
Faulting application start time: 0x01cf22a83ae734f4
Faulting application path: d:\inetpub\_bin\[redacted website name]\PGPTest.exe
Faulting module path: C:\Windows\syswow64\KERNELBASE.dll
Report Id: 789751fa-8e9b-11e3-87e1-0050568e508f
Application: PGPTest.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.IO.FileLoadException
Stack:
at PGPTest.Program.Main(System.String[])
================
.NET Runtime version 4.0.30319.1008 - There was a failure initializing profiling API attach infrastructure. This process will not allow a profiler to attach. HRESULT: 0x80004005
Process ID (decimal): 24328. Message ID: [0x2509].

因此,当我使用 DidiSoft OpenPGP 或 System.Security.Cryptography 时,我会遇到错误。

在经典 ASP 中,应用程序被调用:

WshShell.Exec(%pathtoexe%) 

如果我们将应用程序池更改为在 LocalSystem 而不是 NetworkService 下运行,我们会收到输出 IF。所以它似乎与权限有关。

我们的服务器正在运行:

  • 服务器 2008 R2
  • .NET 4.0

我们假设在 LocalSystem 下运行应用程序池是不安全的;它是否正确?关于我们如何让它发挥作用的任何想法?

谢谢

更新:库的作者已向我确认它的某些算法确实使用了 System.Security.Cryptography。

更新 2:致 ulluoink:如果您读过这篇文章,您就会意识到这实际上与经典 ASP 有关。我怎么知道你问?因为当将代码从 Classic ASP 执行的 C# 应用程序移动到 ASP.NET 4 Web API 应用程序时,完全相同的服务器上的完全相同的代码工作得很好。这似乎是一个与经典 ASP 的执行权限直接相关的权限问题。

因此,当前的解决方法是将引用 System.Security.Cryptography 的代码部署到 ASP.NET Web API 应用程序中的同一服务器。我们在经典 ASP 中发布到 ASP.NET 应用程序;专门发送序列化的数据:http://www.aspjson.com/

最佳答案

是的,作为本地系统运行一个暴露在互联网上的网站是不安全的。您可以在加载页面时使用 filemon 或 processmon 来查看哪些文件需要哪些用户的权限。

http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx

关于c# - IIS 7.5 上经典 ASP 中 WshShell.Exec 的 System.IO.FileLoadException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21587199/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com