.net web程序使用rsa算法進行加解密時,程序報告“System.Security.Cryptography.CryptographicException: 拒絕訪問”錯。現記錄如下:
C:\Documents and Settings\All Users\Application Data
添加項目應用程序池對應啟動帳號(或iis_wpg組) 讀取,讀取並運行,列出文件夾目錄權限。
C:\Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA\MachineKeys
添加項目應用程序池對應啟動帳號(或iis_wpg組)除完全控制和特殊權限以外的所有權限。
后記:
C:\Documents and Settings\All Users\Application Data這個目錄下的權限分配還是有些講究的,對於安全要求高的生產環境服務器,在配置時要格外注意。