Getting “Object is read only” error when setting ClientCredentials in WCF

后端 未结 5 896
迷失自我
迷失自我 2021-02-12 16:11

I have a proxy object generated by Visual Studio (client side) named ServerClient. I am attempting to set ClientCredentials.UserName.UserName/Password before opening up a new co

5条回答
  •  被撕碎了的回忆
    2021-02-12 17:04

    I was facing same problem, my code started working when I changed my code i.e. assigning values to Client credential immediately after initializing Client object.

    here is the solution ,

    ProductClient Manager = new  ProductClient();    
    Manager.ClientCredentials.UserName.UserName = txtUserName.Text;
    Manager.ClientCredentials.UserName.Password = txtPassword.Text;
    

提交回复
热议问题