日期:2014-05-17  浏览次数:20810 次

调用webservice 无响应问题?
本帖最后由 jxdong1013 于 2013-06-28 18:02:14 编辑
调用webservice 无响应问题? 

服务代码如下:

    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    public class WebService1 : System.Web.Services.WebService
    {
        System.Speech.Synthesis.SpeechSynthesizer a = new System.Speech.Synthesis.SpeechSynthesizer();
        [WebMethod]
        public string HelloWorld()
        {
            return "Hello World";
        }

        [WebMethod]
        public void Speak(string txt)
        {          
            a.Speak(txt);
            a.Dispose();
            a = null;
        }

    }

在客户端调用 HellowWorld 方法 正常。调用 Speak方法 无响应。求解?
我怀疑是使用了微软的 System.Speech.Synthesis.SpeechSynthesizer 这个类引起的,但是不知道如何解决?

我在做了一个WCF的服务,代码相同,是正常响应的。
c# speech webservice

------解决方案--------------------
断点~调试~
------解决方案--------------------
Web无法调用本地硬件
而且要WIN7系统才自带语音包,你是XP系统
最好不要在webserivce做这些东西,因为它不是为了这些设计的

弄清需求 合理设计
------解决方案--------------------
a.SpeakText(txt);