2009-06-20 23 views
2

在我的个人网站,我想使其“发音”的东西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) +1565

Version 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访问,是不是一个共享的主机)

+0

我认为你应该考虑问题的可能性_is _文件访问。我不会排除它,因为实际的文件访问是由一段COM代码执行的,可能没有进程? – 2009-06-20 20:46:47

+0

如果我拒绝输出文件夹的写权限,我得到另一个异常:System.Runtime.InteropServices.COMException:无法找到。(异常来自HRESULT:0x80030002(STG_E_FILENOTFOUND)),所以这就是为什么我认为问题是,aspnet用户没有正确的执行sapi语音的权限... – 2009-06-20 21:04:45

回答

2

我通过将AppPool设置为“本地系统”,并通过在machine.config中设置为SYSTEM帐户来工作,从而将它工作。

当然,我觉得作为一个安全问题,因为我正在托管我的个人网站(小)公司服务器(员工明确被公司所有者授权)

也许这不是一个好的解决方案?

我设置此设置只对这个web应用程序,以及(所以有很多虫子在我的代码,在100 WTFs/minute(哈哈)

1

我有过类似的问题衡量,我不是在编码这么好的多后我发现了两个问题,第一个是浏览器,我发现我的目的只有IE浏览器会工作,而不是其他浏览器,如Mozilla。第二个问题是最终的权限,即使我有正确的所有权限,我发现我必须删除互联网用户权限,并检查作为本地帐户选项,然后工作日志