using SpeechLib in ASP.NET

A

Anil

Hi,

I am trying to use the SpeechLib.dll to convert text to speech and
save it into a .wav file using ASP.NET on an Windows 2000 IIS
webserver.

Here is the code:

---------------------------------------------------

SpeechLib.SpFileStream spfilestream;

string filename= "C:\\Anil\\WavTemp2.wav";

spfilestream = new SpFileStreamClass();

spfilestream.Open(filename,SpeechStreamFileMode.SSFMCreateForWrite,false);

SpeechLib.ISpeechVoice ispvoice1= new SpVoiceClass();

ispvoice1.AudioOutputStream = spfilestream;

ispvoice1.Speak("This the text that is being
recorded.",SpeechVoiceSpeakFlags.SVSFDefault);

spfilestream.Close();
-------------------------------------------------------

When I run the code the first time, it creates the .wav file in the
directory but doesnt write anything to it and it gives me an error:


---------------------------------------------------------------------
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.

The ASP.NET process is not authorized to access the requested
resource. For security reasons the default ASP.NET process identity is
'{machinename}\ASPNET', which has limited privileges. Consider
granting access rights to the resource to the ASP.NET process
identity.

To grant ASP.NET write access to a file, right-click the file in
Explorer, choose "Properties" and select the Security tab. Click "Add"
to add the "{machinename}\ASPNET" user. Highlight the ASP.NET account,
and check the Write box in the Allow column.

Source Error:


Line 53: ispvoice1.AudioOutputStream =spfilestream;
Line 54:
Line 55: ispvoice1.Speak("This the text that is being
recorded.",SpeechVoiceSpeakFlags.SVSFDefault);
Line 56:
Line 57: spfilestream.Close();

----------------------------------------------------------------------

I have given the aspnet user access to the .aspx files im using and
SpeechLIb.dll, and the directory that stores the .wav file

When I run the code again while the .wav file exists it throws another
error:

-------------------------------------------------------------------------
Exception from HRESULT: 0x80030002 (STG_E_FILENOTFOUND).
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.Runtime.InteropServices.COMException:
Exception from HRESULT: 0x80030002 (STG_E_FILENOTFOUND).

Source Error:


Line 47: spfilestream = new SpFileStreamClass();
Line 48:
Line 49: spfilestream.Open(filename,SpeechStreamFileMode.SSFMCreateForWrite,false);
Line 50:
Line 51: SpeechLib.ISpeechVoice ispvoice1= new SpVoiceClass();

----------------------------------------------------------------------------


Has anyone done something like this before or understand what the
problem is?

Thanks in Advance
AD
 
B

bvh

Just a guess, but it seems that the IIS_USER account doesn't have
rights to c:\anil. Try making that folder a virtual folder with write
access.

Like I said, just a guess.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top