0

I have created a WebAPI project in .Net Core (3.1) that references / has a dependency to a second project in my solution.

It works perfectly on my local machine, but I published it to my web-host, and I am getting 500 errors from a specific POST method that is using the referenced project.

When I examine the output log, the error looks as follows:

Connection id "0HMFHNV7NFO0R", Request id "0HMFHNV7NFO0R:00000010": An unhandled exception was thrown by the application.
System.UnauthorizedAccessException: Access is denied. (0x80070005 (E_ACCESSDENIED))
at System.Speech.Internal.SapiInterop.ISpRecognizer.SetRecognizer(ISpObjectToken pRecognizer)
...
at <Referenced project & method> in C:\Users\<username>\...\...\....cs:line 23

Basically, from what I'm seeing, it seems my API is actually trying to access the referenced project at it's original location on my local machine (C:\Users<username>..........cs:line 23).

I truly don't understand what's happening here since the rest of the API seems to work well except for the parts referencing the other project, but that doesn't make sense to me since .Net core should just supply the relevant DLLs, no?

As a bit more information, the second library being referenced is using System.Speech which another poster has mentioned may be the issue, but it is a library utilizing .Net Core 3.1 which, to the best of my knowledge, should make it not require anything outside of the provided libraries.

What can I do to fix this / what does this error mean?

John Bustos
  • 19,036
  • 17
  • 89
  • 151

1 Answers1

0

System.Speech requires LocalSystem of Application Pool Identity if you use it in a .net web application. I don't have a better solution, perhaps you can try another Speech library which can work individually for your project. The similar question

  • Henry, I think that was true at the time the previous question was answered, but the version of System.Speech I'm using is using .Net core 3.1 which should not have any kind of dependencies, no?? Please correct me if I'm wrong! – John Bustos Feb 17 '22 at 15:50
  • As I know the System.Speech library is available since .NET Framework 3.0 instead of .NET Core, I am afraid you cannot use it in a .NET Core project directly. I also checked the [.NET API docs](https://learn.microsoft.com/en-us/dotnet/api/system.speech.recognition?view=netframework-4.8), it shows the API is not available for .NET Core. Hope this helps. – Henry Stark Feb 18 '22 at 02:07
  • Henry, that is incorrect. Please see here: https://www.nuget.org/packages/System.Speech – John Bustos Feb 18 '22 at 02:20