【问题标题】:ASP.NET Text to Speech Code working on local dev machine but not on production serverASP.NET 文本到语音代码在本地开发机器上工作,但不在生产服务器上
【发布时间】:2014-04-17 16:10:50
【问题描述】:

我有一个执行文本到语音 TTS 的 ASP.NET 应用程序。该代码在本地机器上运行良好,但是当我将它部署在 Windows 2008 R2 服务器 Enterprise 64 位上时,应用程序池就崩溃了。该应用程序由 v4.0 .NET 框架组成。我在服务器上使用 IIS 7。以下是应用程序池崩溃时的错误。

Service Unavailable

HTTP Error 503. The service is unavailable.

这是我应该更早添加的代码

        MemoryStream ms = new MemoryStream();

        context.Response.ContentType = "audio/wav";

        Thread t = new Thread(() =>
        {
            SpeechSynthesizer ss = new SpeechSynthesizer();
            ss.SetOutputToWaveStream(ms);
            ss.Speak(context.Request.QueryString["tts"]);
        });
        t.Start();

        t.Join();
        ms.Position = 0;
        ms.WriteTo(context.Response.OutputStream);
        context.Response.End();

任何帮助将不胜感激

谢谢

这里是异常的更多细节

An unhandled exception occurred and the process was terminated.

Application ID: /LM/W3SVC/17/ROOT

Process ID: 5340

Exception: System.UnauthorizedAccessException

Message: Retrieving the COM class factory for component with CLSID {A832755E-9C2A-40B4-89B2-3A92EE705852} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).

StackTrace:    at System.Speech.Internal.Synthesis.VoiceSynthesis.Speak(Prompt prompt)
   at System.Speech.Synthesis.SpeechSynthesizer.Speak(Prompt prompt)
   at TTS.<>c__DisplayClass3.<ProcessRequest>b__0()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.runTryCode(Object userData)
   at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

我已授予 IIS_USRS 对文件 C:\Program Files (x86)\Microsoft Speech SDK 5.1\Bin\TTSEng.dll 的完全权限。现在错误已更改为

An unhandled exception occurred and the process was terminated.

Application ID: /LM/W3SVC/17/ROOT

Process ID: 2816

Exception: System.InvalidOperationException

Message: No voice installed on the system or none available with the current security setting.

StackTrace:    at System.Speech.Internal.Synthesis.VoiceSynthesis.Speak(Prompt prompt)
   at System.Speech.Synthesis.SpeechSynthesizer.Speak(Prompt prompt)
   at TTS.<>c__DisplayClass3.<ProcessRequest>b__0()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.runTryCode(Object userData)
   at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

我的服务器上没有任何声音设备。这个异常正确吗?

【问题讨论】:

  • 检查事件查看器中的应用程序日志以获取错误详细信息。
  • 这里是错误日志 应用程序池 'DomainName.com(domain)(4.0)(pool)' 由于服务进程中的一系列故障而被自动禁用应用程序池。为应用程序池“DomainName.com(domain)(4.0)(pool)”提供服务的进程与 Windows 进程激活服务发生了致命的通信错误。进程 ID 为“4948”。数据字段包含错误号。
  • 在该条目之前应该有其他错误可以告诉您实际问题是什么。 IIS 将关闭在特定时间范围内失败特定次数的应用程序池。您可以在应用程序池设置中进行配置。
  • 我在主要问题中添加了异常详细信息。请检查并回复。

标签: asp.net iis-7


【解决方案1】:

尝试关注

  1. IIS 是否正在运行
  2. 默认网站正在运行
  3. 应用程序池和ASP.Net版本
  4. 访问适当

【讨论】:

  • ISS 和默认网站正在运行。 4 中的 ASP.NET 版本和应用程序池的 .NET 版本 4。是的访问是合适的,因为我能够轻松访问网站的其他页面。
  • 文本转语音软件是否试图在任何特定位置访问/写入内容/文件(线程无法访问?)
  • 下载ProcessExplorer并尝试逐步分析
  • 也禁用防病毒软件并重试。有时它可能会阻止访问某些临时/生成的文件
  • 问题在于授予适当的访问权限。我已将应用程序池的标识设置为“LocalSystem”。现在它工作正常。
【解决方案2】:

zahid 在这里有正确的答案。 在 IIS 中,选择应用程序池,单击高级设置,然后选择身份类型。

语音需要访问用户级别的数据。

【讨论】:

  • 我遇到了同样的问题,通过将身份更改为我们服务器上的本地系统解决了这个问题。但是,当我在 A2 托管或 Godaddy 等公共主机上发布应用程序时,解决方案是什么?
【解决方案3】:

尝试为运行应用程序池的同一用户授予对 C:\windows\system32\config\systemprofile\appdata\roaming 的读/写访问权限。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-11-05
    • 1970-01-01
    • 1970-01-01
    • 2021-12-28
    • 1970-01-01
    • 1970-01-01
    • 2021-07-23
    • 2014-06-19
    相关资源
    最近更新 更多