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

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

    I noticed that after creating an instance of the proxy class for the service, I can set the Username and Password once without errors and do a successful call to my webservice. When I then try to set the Username and Password again on the existing instance (unnecessary of course) I get the 'Object is Read-Only' error you mentioned. Setting the values once per instance lifetime worked for me.

提交回复
热议问题