我在VS2010上运行SL4。我有一个应用程序,通过Web服务对我的数据库中的SPROC进行身份验证。不幸的是,这不是WCF/WCF RIA,因为我从客户端继承了DB /服务。与“远程服务器返回错误:NotFound”的乐趣 - Silverlight4在浏览器外
这在浏览器内部完美运行(通过HTTPS)。我试图移动这个OOB,并且此时我的身份验证失败。下面是我所采取的步骤......
1)SL应用性能>启用运行应用程序在浏览器 2)SL应用属性>的脱离浏览器设置的>需要运行OOB
时如果设置了一个提升的信任点击我的登录按钮上的断点,我看到服务调用正在进行。但是,如果我通过它(或在实际的登录Web服务上设置断点),代码永远不会达到那么远。这是它失败的块:
public LogonSVC.LogonResponse EndLogon(System.IAsyncResult result) {
object[] _args = new object[0];
LogonSVC.LogonResponse _result = ((LogonSVC.LogonResponse)(base.EndInvoke("Logon", _args, result)));
return _result;
}
我知道使用Elevated Trust意味着crossdomain.xml不是必需的。我放弃了一切,只是为了测试,但仍然失败。
这里调用该服务的代码:
private void loginButton_Click(object sender, RoutedEventArgs e)
{
string Username = txtUserName.Text;
string Password = txtPassword.Password;
Uri iSilverlightServiceUriRelative = new Uri(App.Current.Host.Source, "../Services/Logon.asmx");
EndpointAddress iSilverlightServiceEndpoint = new EndpointAddress(iSilverlightServiceUriRelative);
BasicHttpBinding iSilverlightServiceBinding = new BasicHttpBinding(BasicHttpSecurityMode.Transport);// Transport if it's HTTPS://
LogonService = new LogonSVC.LogonSoapClient(iSilverlightServiceBinding, iSilverlightServiceEndpoint);
LogonService.LogonCompleted += new EventHandler<LogonSVC.LogonCompletedEventArgs>(LogonService_LogonCompleted);
LogonService.LogonAsync(Username, Password);
}
我LogonService_LogonCompleted不火或者(这是有道理的,只是抬起头)。
我不知道如何摆弄这个,因为这是通过本地主机/ IIS服务的网站运行OOB。我知道这个工程虽然在浏览器,所以我很好奇什么会打破它的OOB。
UPDATE 我改变了我的ServiceReferences.ClientConfig相对URL而不是绝对的,在我读的另一篇文章的推荐。下面的代码:
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="CommonSoap" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<security mode="Transport" />
</binding>
<binding name="LogonSoap" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<security mode="Transport" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="/Services/Common.asmx"
binding="basicHttpBinding" bindingConfiguration="CommonSoap"
contract="CommonSVC.CommonSoap" name="CommonSoap" />
<endpoint address="/Services/Logon.asmx"
binding="basicHttpBinding" bindingConfiguration="LogonSoap"
contract="LogonSVC.LogonSoap" name="LogonSoap" />
</client>
</system.serviceModel>
更新2
堆栈跟踪,如果它可以帮助任何人......
at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
at System.ServiceModel.ClientBase`1.ChannelBase`1.EndInvoke(String methodName, Object[] args, IAsyncResult result)
at TSMVVM.TSMVVMLogonSVC.LogonSoapClient.LogonSoapClientChannel.EndLogon(IAsyncResult result)
at TSMVVM.TSMVVMLogonSVC.LogonSoapClient.TSMVVM.TSMVVMLogonSVC.LogonSoap.EndLogon(IAsyncResult result)
at TSMVVM.TSMVVMLogonSVC.LogonSoapClient.EndLogon(IAsyncResult result)
at TSMVVM.TSMVVMLogonSVC.LogonSoapClient.OnEndLogon(IAsyncResult result)
at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)
谢谢
斯科特
此错误表示服务器上存在问题。像这样执行诊断:http://stackoverflow.com/questions/4773026/how-to-debug-wcf-service-call-works-in-vs-but-not-in-iis/4783388#4783388并添加有关信息一个真正的错误类型。 – vorrtex 2011-02-15 09:30:40
嘿Vorrtex。这似乎是为WCF。我试着实现它(只需将system.diagnostics添加到我的web.config中,是吗?)。没有日志文件。我没有使用WCF,我正在使用asmx Web服务。 – 2011-02-15 17:27:43