快捷搜索:  xxx  as  推理研究所  幼幼  侦探研究所

英皇国际棋牌app:WCF wsHttpBinding使用Transport security Mode且lientCredentialType=”Basic”(2)



client app.config:

xml version="1.0" encoding="utf-8" ?>

configuration>system.serviceModel>

bindings>wsHttpBinding>

binding name="WSHttpBinding_IDemoService">security mode="Transport">

transport clientCredentialType="Basic" />security>

binding>wsHttpBinding>

bindings>client>

endpo英皇国际棋牌appint address="https://win-ounm08eqe64.henry.huang/DemoService.svc/DemoService"binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IDemoService"

contract="DemoServiceReference.IDemoService" name="WSHttpBinding_IDemoService" />client>

system.serviceModel>configuration>

public partial class Form1 : Form

{DemoServiceReference.DemoServiceClient demoServiceClient;

public Form1()

{InitializeComponent();

demoServiceClient = new DemoServiceReference.DemoServiceClient();demoServiceClient.ClientCrede英皇国际棋牌appntials.UserName.UserName = "alex"英皇国际棋牌app;

demoServiceClient.ClientCredentials.UserName.Password = "123456";}

private void buttonCalculate_Click(object sender, EventArgs e)

{try

{text英皇国际棋牌appBoxResult.Text = demoServiceClien英皇国际棋牌appt.Divide(Convert.ToInt32(textBoxNumerator.Text), Convert.ToInt32(textBoxDenominator.Text)).ToString();

}catch (FaultException fault)

{MessageBox.Show(fault.Detail.Error + " - " + fault.Detail.Detail);

}}

}

调用成功。

免责声明:以上内容源自网络,版权归原作者所有,如有侵犯您的原创版权请告知,我们将尽快删除相关内容。

您可能还会对下面的文章感兴趣: