ASP.NET Web 服务应用程序中 INI 文件的保存位置
我编写了一个Web服务应用程序,因为我创建了一个INI文件来保存所需的所有服务器URL,但是每当我要访问INI文件时我都无法访问该INI文件它会向我显示此错误,
System.IO.FileNotFoundException: Could not find file 'c:\windows\system32\inetsrv\default.ini'.
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)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize)
at System.IO.StreamReader..ctor(String path)
at DARDMeatInspection.services.QABMeatInspectionService.ReadINI() in D:\DARD\trunk\server\DARDMeatInspection\DARDMeatInspection\services\QABMeatInspectionService.asmx.cs:line 116
at DARDMeatInspection.services.QABMeatInspectionService.GetAllClassifiers() in D:\DARD\trunk\server\DARDMeatInspection\DARDMeatInspection\services\QABMeatInspectionService.asmx.cs:line 27
另外,部署后是否可以更改INI文件的内容? 如果我错了请纠正我。任何帮助将不胜感激。
I have written a web service application, in that I have created an INI file in order to save all the server URLs required, but I couldn't access that INI file whenever I am going to access INI file It will show me this error,
System.IO.FileNotFoundException: Could not find file 'c:\windows\system32\inetsrv\default.ini'.
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)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize)
at System.IO.StreamReader..ctor(String path)
at DARDMeatInspection.services.QABMeatInspectionService.ReadINI() in D:\DARD\trunk\server\DARDMeatInspection\DARDMeatInspection\services\QABMeatInspectionService.asmx.cs:line 116
at DARDMeatInspection.services.QABMeatInspectionService.GetAllClassifiers() in D:\DARD\trunk\server\DARDMeatInspection\DARDMeatInspection\services\QABMeatInspectionService.asmx.cs:line 27
Also, is it possible to change content of INI file after deployment?
If I am wrong please correct me. Any help will be highly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为什么不将配置存储在 app.config/web.config 文件中?
然后使用获取你的值
Why don't you store your configuration in your app.config/web.config file?
Then grab your values using
App_Data 可能是一个可行的候选者,特别是因为
The App_Data may be a viable candidate, especially because