开发者

Silverlight and WebService

I am working on a silverlight project which is a kind of virtual order. At the end it completes the input data and sends them as a mail . However you cannot send mails in silverlight because it doesnt allow .NET libraries which I use for sending mails (System.Net.Mail) so I am using a web service to send that mail . I use these functions :

  1. In silverlight

    public sta开发者_StackOverflow社区tic void SendAsMail()
    {
        MailServiceSoapClient client = new MailServiceSoapClient(); // Client of WebService
        client.SendMailAsync(output.ToString()); // output is the text of mail
    }

  2. In WebService

    
    [WebService(Namespace = "http://www.mydomain.sk/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
        public class MailService : System.Web.Services.WebService
        {
            [WebMethod]
            public bool SendMail(string mail_text)
            {
                MessageBox.Show("connected");
                // function which sends mail
                return true;
            }
        }
    
    I have added the MessageBox function to know if i have accessed the WebService. When I click the button which connects to WebService, it does nothing.

I don't know how to fix this, please help

Thank you


There is no way you can use a messagebox from a web service which runs inside IIS and has no user interface, this is not a windows application.

Try to replace messagebox.show with a logging method either in the windows EventLog or on a text file and check how it works.


Make a service method that returns a value. Then you can use that to return any error messages or success messages

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜