Установка учетных данных для приложения WCF?

Вы можете проверить минус, проверив пустую строку not in в вашем списке.

if ' ' not in board:
     # Board is full.

Если вы используете '' для значения пустого квадрата, вы также можете использовать all(), чтобы проверить, что все значения равны True. Пустая строка уже имеет значение False в Python, а любая другая строка - True, так что вы можете просто протестировать плату напрямую.

>>> board = ['x', 'x', '']
>>> all(board)
False

>>> board = ['x', 'x', 'o']
>>> all(board)

Вы бы использовали его как

if all(board):
    # Board is full.
7
задан Omar Kooheji 15 May 2009 в 09:43
поделиться

2 ответа

Create a method like this...

void SetImpersonation(ref IServiceClient proxy)
{
  proxy.ClientCredentials.Windows.ClientCredential.Domain = "MYDOMAIN";
  proxy.ClientCredentials.Windows.ClientCredential.UserName = "A_USER";
  proxy.ClientCredentials.Windows.ClientCredential.Password = "P4SSW0RD";
}

and call it when you create the new client class.

IServiceClient proxy = new IServiceClient ();
SetImpersonation(ref proxy);

Obvously, this is setting the information to be a specific user, and has security implications if your code is decompiled, but it should work in your (config file-less scenario)

5
ответ дан 6 December 2019 в 11:52
поделиться

Here's a solution I found in a search for disabling wcf security/authentication.

From MSDN:

WSHttpBinding b = new WSHttpBinding();

b.Security.Mode = SecurityMode.None;

or add the following in config:

<wsHttpBinding>

    <binding name="myBinding">

        <security mode="None" />

    </binding>

</wsHttpBinding>
11
ответ дан 6 December 2019 в 11:52
поделиться
Другие вопросы по тегам:

Похожие вопросы: