我制作了一个 Silverlight 应用程序 WCF RIA 服务,它有一个登录页面,用于验证数据库中的用户名和密码......当我从 VS2010 调试时它运行良好,但是当我发布到 IIS7 时它不再与数据库连接...我已经在 Web.config 中进行了所有设置 ...我已将 clientaccesspolicy.xml 和 crossdomain.xml 添加到我的项目中...将 MIME 类型添加到 IIS7 中没有结果...我发现来自 IE9 的开发工具出现错误,它说:
SCRIPT5022: Unhandled Error in Silverlight Application An exception occurred during the operation, making the result invalid. Check InnerException for exception details. at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary()
at MaG.ServiceReference1.LoginCompletedEventArgs.get_Result()
at MaG.MainPage.connection_LoginCompleted(Object sender, LoginCompletedEventArgs e)
at MaG.ServiceReference1.Service1Client.OnLoginCompleted(Object state)
MaGTestPage.html, line 1 character 1
我将登录方法客户端上诉到 web 服务,如下所示:
try
{
ServiceReference1.Service1Client connection = new ServiceReference1.Service1Client();
connection.LoginCompleted += new EventHandler<ServiceReference1.LoginCompletedEventArgs>(connection_LoginCompleted);
connection.LoginAsync(textBox1.Text, passwordBox1.Password);
}
catch (Exception ex)
{
Console.Write(ex.InnerException);
}