Web 服务中的 Microsoft 语音识别未返回结果
嗯,我正在使用 Microsoft 语音平台 SDK 10.2。
我制作了一个 asp.Net WebService 应用程序,大多数 Web 服务工作正常(HelloWorld() 等...),但我有一项使用 SpeechRecognitionEngine 的服务,当我部署该应用程序并尝试运行此 Web 服务时,我没有得到任何结果结果,即我可以通过调试模式看到它到达返回行,但是当我通过浏览器调用它时,页面会永远加载,没有任何响应。
以下是代码示例:
[WebMethod]
public bool voiceRecognition() {
SpeechRecognitionEngine sre = new SpeechRecognitionEngine(new System.Globalization.CultureInfo("pt-PT"));
Choices c = new Choices();
c.Add("test");
GrammarBuilder gb = new GrammarBuilder();
gb.Append(c);
Grammar g = new Grammar(gb);
sre.LoadGrammar(g);
sre.InitialSilenceTimeout = TimeSpan.FromSeconds(5);
//// just for Testing
RecognitionResult result = null;
if (result != null) {
return true;
} else {
return false;
}
}
注意:我使用 IIS 来部署 WebService 应用程序。
如果有人有一些想法请告诉我。
Well i'm using Microsoft Speech Platform SDK 10.2.
I made a asp.Net WebService application and most of the WebServices works fine (HelloWorld(), etc...), but I have one service that uses the SpeechRecognitionEngine and when I deploy the application and try to run this webservice I get no result, i.e, I can see through the debug mode that it reaches the return line, but when I call it trought the browser the page keeps loading for ever, without any response.
Here's a sample of the code:
[WebMethod]
public bool voiceRecognition() {
SpeechRecognitionEngine sre = new SpeechRecognitionEngine(new System.Globalization.CultureInfo("pt-PT"));
Choices c = new Choices();
c.Add("test");
GrammarBuilder gb = new GrammarBuilder();
gb.Append(c);
Grammar g = new Grammar(gb);
sre.LoadGrammar(g);
sre.InitialSilenceTimeout = TimeSpan.FromSeconds(5);
//// just for Testing
RecognitionResult result = null;
if (result != null) {
return true;
} else {
return false;
}
}
Note: I'm using IIS to deploy the WebService Application.
If someone have some thoughts please let me know.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不知道你是否已经找到答案了。几天前,当我试图自己解决这个问题时,我偶然发现了你的问题,它与我们的情况符合“T”。
为了解决这个问题,我们所要做的就是......
其中“sre”是您的 SpeechRecognitionEngine 变量。如果您不停止它并在 Web 服务结束时处理它,那么 Web 服务将不会返回。
希望这有帮助。 :)
I don't know if you've found your answer or not. When trying to solve this myself a couple of days ago, I stumbled across your question and it matched our circumstances to a "T".
In order to fix it all we had to do was put...
where "sre" is your SpeechRecognitionEngine variable. If you don't stop it and dispose of it at the end of your web service then the web service won't return.
Hope this helps. :)