powered by simpleCommunicator - 2.0.18     © 2024 Programmizd 02
Map
Форумы / WCF, Web Services, Remoting [игнор отключен] [закрыт для гостей] / аутентификация с winforms в вебслужбе
3 сообщений из 3, страница 1 из 1
аутентификация с winforms в вебслужбе
    #40060649
Voevoda-Moroz
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Здравствуйте. Помогите ввести пароль и логин в вебслужбу.
выскакивает ошибка : Запрос HTTP не разрешен для схемы проверки подлинности клиента "Anonymous". От сервера получен заголовок проверки подлинности "Basic realm="SAP NetWeaver Application Server [D03/040]"".
config клиента
Код: xml
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.diagnostics>
    <sources>
      <!-- В этой секции определяется конфигурация ведения журнала для My.Application.Log -->
      <source name="DefaultSource" switchName="DefaultSwitch">
        <listeners>
          <add name="FileLog"/>
          <!-- Раскомментируйте следующую секцию для записи в журнал событий приложения -->
          <!--<add name="EventLog"/>-->
        </listeners>
      </source>
    </sources>
    <switches>
      <add name="DefaultSwitch" value="Information" />
    </switches>
    <sharedListeners>
      <add name="FileLog"
           type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
           initializeData="FileLogWriter"/>
      <!-- Раскомментируйте следующую секцию и замените APPLICATION_NAME на имя своего приложения для записи в журнал событий приложения -->
      <!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
    </sharedListeners>
  </system.diagnostics>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="ZWSBSK_GET_ACTS" closeTimeout="00:01:00" openTimeout="00:01:00"
            receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
            bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
            maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
            messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
            useDefaultWebProxy="true">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
              maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <security mode="Transport">
            <transport clientCredentialType="None" proxyCredentialType="None"
                realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
        <binding name="ZWSBSK_GET_ACTS1" closeTimeout="00:01:00" openTimeout="00:01:00"
            receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
            bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
            maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
            messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
            useDefaultWebProxy="true">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
              maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None"
                realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="https://d03.enmashbel.ru:5200/sk/getacts"
          binding="basicHttpBinding" bindingConfiguration="ZWSBSK_GET_ACTS"
          contract="ServiceReference1.zwssk_Get_Acts" name="ZWSBSK_GET_ACTS" />
    </client>
  </system.serviceModel>
</configuration>



код :
Код: vbnet
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
 Private myMathServicet As New proba3.ServiceReference1.zwssk_Get_ActsClient
    Private myMathServicet1 As New proba3.ServiceReference1.Z_SK_GET_ACTS
    Private myMathServicetr As New proba3.ServiceReference1.Z_SK_GET_ACTSResponse

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        myMathServicet.ClientCredentials.UserName.UserName = "MMM44"
        myMathServicet.ClientCredentials.UserName.Password = "4321"
        myMathServicet1.ERDAT = "02.11.2020"
        myMathServicetr = myMathServicet.Z_SK_GET_ACTS(Z_SK_GET_ACTS1:=myMathServicet1)
    End Sub



на myMathServicetr = myMathServicet.Z_SK_GET_ACTS(Z_SK_GET_ACTS1:=myMathServicet1) ругается.
что делаю не так?
...
Рейтинг: 0 / 0
аутентификация с winforms в вебслужбе
    #40060696
Roman Mejtes
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
В настройках ASP.NET приложения в диспетчере IIS есть настройки подлинности

...
Рейтинг: 0 / 0
аутентификация с winforms в вебслужбе
    #40060744
Voevoda-Moroz
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
нашел на просторах инета ответ, пишу,кому понадобится работающее решение
меняем в config
Код: xml
1.
2.
3.
4.
5.
  <security mode="Transport">
            <transport clientCredentialType="None" proxyCredentialType="None"
                realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>


на
Код: xml
1.
2.
3.
   <security mode="Transport">
            <transport clientCredentialType="Basic" />
          </security>



в коде прописываем следующее
Код: vbnet
1.
2.
3.
4.
5.
6.
7.
  Dim myBinding As New WSHttpBinding()
        myBinding.Security.Mode = SecurityMode.Transport
        myBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic
        Dim ea As New EndpointAddress("https://d03.emachful.ru:5200/sk/getacts")
        Dim cc As New ServiceReference1.zwssk_Get_ActsClient(myBinding, ea)
        cc.ClientCredentials.UserName.UserName = "MMMM44"
        cc.ClientCredentials.UserName.Password = "12345"
...
Рейтинг: 0 / 0
3 сообщений из 3, страница 1 из 1
Форумы / WCF, Web Services, Remoting [игнор отключен] [закрыт для гостей] / аутентификация с winforms в вебслужбе
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Найденые пользователи ...
Разблокировать пользователей ...
Читали тему (1): Анонимы (1)
Читали форум (2): Анонимы (2)
Пользователи онлайн (10): Анонимы (6), Bing Bot 1 мин., RePredeclared 3 мин., Yandex Bot 6 мин., CerebroSQL 6 мин.
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]