3

On my personal website, i would like to make it "pronounce" something

I solved the "concept" problem, as in here, and on my desktop it works smoothly when launched from visual web developer. Creates a file, and then an embedded player in the page will play it. Perfect.

So, I uploaded it on the server... I get this error 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

This is the source

Source Error:

Line 19: myfile.Open(@"C:\mypath\sapi\gen\hi.wav",SpeechStreamFileMode.SSFMCreateForWrite,false);
Line 20: voice.AudioOutputStream = myfile;
Line 21: voice.Speak("Hi",SpeechVoiceSpeakFlags.SVSFDefault);

I get error on line 21, Voice.speak

That probably means that the aspnet worker user has not some right permission

The generation folder has all the right permissions: an empty file is created.

So, i have to give permission of execute to some system dll?

Do you know which dll? It is not bin\Interop.SpeechLib.dll, on this one the aspnet user has full control

Ps: i have full control on the (windows) server (i mean, access by RDC, is not a shared hosting)

Community
  • 1
  • 1
Magnetic_dud
  • 1,506
  • 2
  • 22
  • 36
  • I think you should consider the possibility that the problem _is_ the file access. I wouldn't rule it out, given that the actual file access is being performed by a piece of COM code, possibly running out of process? – John Saunders Jun 20 '09 at 20:46
  • if i deny write permissions on the output folder, i get another exception: System.Runtime.InteropServices.COMException: could not be found. (Exception from HRESULT: 0x80030002 (STG_E_FILENOTFOUND)), so that's why i think the problems is that the aspnet user hasn't the right persmission to run the sapi voice... – Magnetic_dud Jun 20 '09 at 21:04
  • also, the wav is created, and it contains the wav header: RIFF&_____WAVEfmt____data but not the file stream, so it looks like the dll to make it "fill", is blocked? – Magnetic_dud Jun 20 '09 at 21:17
  • Possible duplicate of [Creating a ASP.NET application converting text to speech](http://stackoverflow.com/questions/1716447/creating-a-asp-net-application-converting-text-to-speech) – Nikolay Shmyrev Jan 19 '17 at 08:42

2 Answers2

2

I got it working by setting the AppPool as working as "Local System" and by setting in the machine.config to work as SYSTEM account

Of course i feel that as a security issue, as i am hosting my personal website on the (small) company server (Employees are explicitly authorized to do so by the company owner)

Maybe this is not a good solution?

I set this setting only for this webapp, and i am not so good at coding (so there are lots of bugs in my code, measured in 100 WTFs/minute (haha)

Magnetic_dud
  • 1,506
  • 2
  • 22
  • 36
  • I think because the default ASPNET user has "guest" privileges, (if i am right), so **maybe**, running it as local system, will allow to run system files – Magnetic_dud Jun 20 '09 at 22:19
  • Can you please explain how you did this? I have exactly the same issue that I am unable to resolve. I did set the AppPool to run as "Local System" and it did not help – DotnetDude Dec 30 '09 at 11:22
  • well, i am not sure what i did, i am quite a noob. i think that bin\Interop.SpeechLib.dll must have the right permissions for the working process user – Magnetic_dud Jan 05 '10 at 18:38
1

I have had similar problems, after many headaches i did manage to solve the issue with me. I found two problems the first being the browser, i found for my purpose only ie explorer would work and not other browsers such as mozilla. The second problem was finally the permissions, even though i had all permissions correctly i found that i had to remove the internet user permission and check the log on as local account option which then worked.

Kevin
  • 11
  • 1