在我的個人網站,我想使其「發音」的東西ASP.NET中的文本到語音 - 訪問被拒絕...該怎麼辦?
我解決了這個「概念」的問題,因爲在here,我的桌面上,從Visual Web Developer中啓動時它工作的順利進行。創建一個文件,然後頁面中的嵌入式播放器將播放它。完善。
所以,我上傳到服務器上...我得到這個錯誤500:
Server Error in '/sapi' Application. Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) 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.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via , the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.
(...)
Source Error:
See it below
Source File: c:\mypath\sapi\myfile.aspx.cs Line: 21
Stack Trace:
[UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))]
SpeechLib.SpVoiceClass.Speak(String Text, SpeechVoiceSpeakFlags Flags) +0 prova.Button1_Click(Object sender, EventArgs e) in c:\mypath\sapi\prova.aspx.cs:21 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) +1565Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053
這是源
源錯誤:
第19行:myfile.Open(@"C:\mypath\sapi\gen\hi.wav",SpeechStreamFileMode.SSFMCreateForWrite,false);
第20行:voice.AudioOutputStream = myfile;
第21行:voice.Speak("Hi",SpeechVoiceSpeakFlags.SVSFDefault);
我第21行出現錯誤,Voice.speak
這可能意味着,ASPNET工作用戶還沒有正確的某些許可
生成文件夾擁有所有正確的權限:創建一個空文件。
那麼,我必須給某些系統DLL授予執行權限?
你知道哪個dll嗎?這是不bin\Interop.SpeechLib.dll
,就這一個ASPNET用戶具有完全控制
PS:我對(窗口)完全控制服務器(我的意思是,通過RDC訪問,是不是一個共享的主機)
我認爲你應該考慮問題的可能性_is _文件訪問。我不會排除它,因爲實際的文件訪問是由一段COM代碼執行的,可能沒有進程? – 2009-06-20 20:46:47
如果我拒絕輸出文件夾的寫權限,我得到另一個異常:System.Runtime.InteropServices.COMException:無法找到。(異常來自HRESULT:0x80030002(STG_E_FILENOTFOUND)),所以這就是爲什麼我認爲問題是,aspnet用戶沒有正確的執行sapi語音的權限... – 2009-06-20 21:04:45