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

后端 未结 5 898
迷失自我
迷失自我 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 16:54

    I have similar code that's passing UserName fine:

      FooServiceClient client = new FooServiceClient("BasicHttpBinding_IFooService");
      client.ClientCredentials.UserName.UserName = "user";
      client.ClientCredentials.UserName.Password = "password";
    

    Try creating the proxy with binding name in app.config.

提交回复
热议问题