VS2010 で SL4 を実行しています。データベースで SPROC に対して Web サービスを介して認証するアプリがあります。残念ながら、クライアントから DB/サービスを継承しているため、これは WCF/WCF RIA ではありません。
これは、ブラウザー内で (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も起動しません(これは理にかなっていますが、注意してください)。
これは、localhost/IIS を介して提供されるサイトで OOB を実行しているため、これをいじる方法がわかりません。これはブラウザでも機能することを知っているので、何がOOBを壊すのか興味があります。
更新 私が読んだ別の投稿の推奨により、ServiceReferences.ClientConfigを絶対URLではなく相対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)
ありがとうございました、
スコット