gpt4 book ai didi

.net - 防止 .NET 写入 C :\Windows\Temp

转载 作者:行者123 更新时间:2023-12-04 19:23:36 24 4
gpt4 key购买 nike

我有一个 C# 应用程序,我正在尝试将其推送到分布式网络。该应用程序在本地运行良好(一如既往),但是当我将其推送到网络时,它不起作用,因为它无法写入 C:\Windows\Temp 目录。我实际上并没有调用任何写入该目录的代码,但我想它是由我对网络服务的调用引起的,考虑到以下异常:

Unable to generate a temporary class (result=1). error CS2001: Source file 'C:\WINDOWS\TEMP\cyalinh1.0.cs' could not be found error CS2008: No inputs specified '. Please see InnerException for more details.



有什么办法可以防止 .NET 写入 Temp 目录?它是 .config 文件中的设置吗?

更新

可以使用 SGEN 来阻止从 Web 服务创建那些动态创建的类吗?

最佳答案

似乎网络服务需要对 %SystemRoot%\Temp ( MSDN ) 的读/写权限。

来自 here :

If you're running ASP.NET 2.0 or above, you can assign the required permissions with the command:

aspnet_regiis -GA MachineName\Account


blog post包含有关如何更改用于此的 SystemRoot\Temp 文件夹位置的说明(以及有关如何使用反射器确定 web.config 中的设置以针对此类情况进行设置的说明)

关于.net - 防止 .NET 写入 C :\Windows\Temp,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1717574/

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