2011-07-29 40 views
1

試圖讓一個網絡應用程序工作。調試時(在釋放和調試模式下),但是當我發佈到Web服務器,我打試圖訪問本地文件時出錯..不能在服務器上運行Web應用程序 - 在調試時運行良好 - 權限問題?

" 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.IO.IOException: Logon failure: unknown user name or bad password. 
" 

"Stack Trace: 


[IOException: Logon failure: unknown user name or bad password. 
] 
    System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +7717304 
    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) +1162 
    System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options) +65 
    System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize) +87 
    System.IO.StreamReader..ctor(String path) +30 
    ASP_FSR.SmokeBooks.GetSmokeBookList(String configlocation) in C:\ASP_TEST\ASP_FSR\ASP_FSR\SmokeBooks.cs:39 
    ASP_FSR.Foundry_Data.getData(String report, String smokeconfig) in C:\ASP_TEST\ASP_FSR\ASP_FSR\Foundry_Data.cs:36 
    ASP_FSR.Check.RunCheck() in C:\ASP_TEST\ASP_FSR\ASP_FSR\Check.cs:49 
    ASP_FSR._Default.Button1_Click(Object sender, EventArgs e) in C:\ASP_TEST\ASP_FSR\ASP_FSR\Default.aspx.cs:65 
    System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111 
    System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110 
    System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10 
    System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13 
    System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36 
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565 
" 

我已經加入了用戶ASP.NET計算機帳戶工作正常(\ ASPNET)到文件所在的目錄(與應用程序相同)

回答

3

當您在IIS中運行Web應用程序時,它是AppPool在其下運行的用戶。

這有所不同,因此請檢查IIS中的設置,併爲此帳戶分配權限,而不是分配給相關文件夾。

http://www.advancedinstaller.com/user-guide/iis-app-pool-identity.html

+0

感謝,愚蠢的問題,我該如何找到應用程序池下運行的用戶? –

+2

您使用的是哪個版本的IIS? – BonyT

0

這似乎是您的應用程序試圖在未能訪問文件(S)。你確定你給IIS的文件的應用程序寫入/讀取權限嗎?

+0

這可能是答案。我只是簡單地將ASPNET用戶訪問權限添加到所有文件所在的文件夾中。因此,我還需要授予應用程序訪問權限? –

1

顯然這是一個權限問題。如果您確定ASP.NET帳戶配置正確,那麼您是否在web.config中執行任何身份模擬,即<identity impersonate="true" userName=...,如果是,是否正確配置了此帳戶?

0

遲到的迴應,但回頭看看這個網站,雖然我應該更新任何有類似問題的人。

是的,這是一個權限問題。正如巴里提及我需要爲服務器帳戶登錄假冒訪問臨時目錄的等

相關問題