Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Запрос HTTP не разрешен для схемы аутентификации клиента "Anonymous". От сервера получен заголовок аутентификации "Basic realm="1C:Enterprise 8.3"".
- <bindings>
- <basicHttpBinding>
- <binding name="BasicAuth">
- <security mode="TransportCredentialOnly">
- <transport clientCredentialType="Basic" />
- </security>
- </binding>
- </basicHttpBinding>
- </bindings>
- <configuration>
- <configSections>
- <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
- <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
- </configSections>
- <connectionStrings>
- <remove name="LocalSqlServer" />
- <add name="ScanStoreEntities" connectionString="" providerName="System.Data.EntityClient" />
- <add name="MembershipConnection" connectionString="" providerName="System.Data.SqlClient" />
- </connectionStrings>
- <appSettings>
- <add key="webpages:Version" value="2.0.0.0" />
- <add key="webpages:Enabled" value="false" />
- <add key="PreserveLoginUrl" value="true" />
- <add key="ClientValidationEnabled" value="true" />
- <add key="UnobtrusiveJavaScriptEnabled" value="true" />
- <add key="StorePath" value="" />
- <add key="IronManPath" value="" />
- </appSettings>
- <system.web>
- <customErrors mode="Off" />
- <compilation debug="true" targetFramework="4.5">
- <assemblies>
- <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
- </assemblies>
- </compilation>
- <httpRuntime maxQueryStringLength="1048575" maxRequestLength="1048575" executionTimeout="3600" targetFramework="4.5" />
- <authorization>
- <allow users="?" />
- </authorization>
- <authentication mode="Forms">
- <forms loginUrl="~/Account/Login" timeout="2880" name="PKB_AUTH" />
- </authentication>
- <profile>
- <providers>
- <clear />
- <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/" />
- </providers>
- </profile>
- <roleManager enabled="true">
- <providers>
- <clear />
- <add connectionStringName="MembershipConnection" applicationName="/" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" />
- <add applicationName="/" name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" />
- </providers>
- </roleManager>
- <pages controlRenderingCompatibilityVersion="4.0">
- <namespaces>
- <add namespace="System.Web.Helpers" />
- <add namespace="System.Web.Mvc" />
- <add namespace="System.Web.Mvc.Ajax" />
- <add namespace="System.Web.Mvc.Html" />
- <add namespace="System.Web.Optimization" />
- <add namespace="System.Web.Routing" />
- <add namespace="System.Web.WebPages" />
- </namespaces>
- </pages>
- <membership>
- <providers>
- <clear />
- <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="MembershipConnection" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="8" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" passwordFormat="Hashed" />
- </providers>
- </membership>
- </system.web>
- <system.webServer>
- <validation validateIntegratedModeConfiguration="false" />
- <modules runAllManagedModulesForAllRequests="true" />
- <handlers>
- <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
- <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
- <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
- <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%Microsoft.NETFrameworkv4.0.30319aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
- <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%Microsoft.NETFramework64v4.0.30319aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
- <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
- </handlers>
- <urlCompression doStaticCompression="true" doDynamicCompression="true" />
- <security>
- <requestFiltering>
- <requestLimits maxUrl="10999" maxQueryString="2097151" maxAllowedContentLength="1073741824" />
- </requestFiltering>
- </security>
- </system.webServer>
- <runtime>
- <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
- <dependentAssembly>
- <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
- <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="System.Web.WebPages.Razor" publicKeyToken="31bf3856ad364e35" />
- <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
- <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
- <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="Antlr3.Runtime" publicKeyToken="eb42632606e9261f" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2" />
- </dependentAssembly>
- </assemblyBinding>
- </runtime>
- <entityFramework>
- <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
- <parameters>
- <parameter value="v11.0" />
- </parameters>
- </defaultConnectionFactory>
- <providers>
- <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
- </providers>
- </entityFramework>
- <system.serviceModel>
- <bindings>
- <basicHttpBinding>
- <binding name="HKDSoapBinding" />
- </basicHttpBinding>
- <customBinding>
- <binding name="HKDSoap12Binding">
- <security mode="TransportCredentialOnly">
- <transport clientCredentialType="Basic" />
- </security>
- <textMessageEncoding messageVersion="Soap12" />
- <httpTransport />
- </binding>
- </customBinding>
- </bindings>
- <client>
- <endpoint address="http://172.16.0.3/Test_BIT/ws/hkd.1cws" binding="basicHttpBinding"
- bindingConfiguration="HKDSoapBinding" contract="ServiceReference1C.HKDPortType"
- name="HKDSoap" />
- <endpoint address="http://172.16.0.3/Test_BIT/ws/hkd.1cws" binding="customBinding"
- bindingConfiguration="HKDSoap12Binding" contract="ServiceReference1C.HKDPortType"
- name="HKDSoap12" />
- </client>
- </system.serviceModel>
- </configuration>
- BasicHttpBinding myBinding = new BasicHttpBinding();
- myBinding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;
- myBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;
- EndpointAddress ea = new EndpointAddress("http://172.16.0.3/Test_BIT/ws/hkd.1cws");
- restcoachPortTypeClient Service = new restcoachPortTypeClient(myBinding, ea);
- Service.ClientCredentials.UserName.UserName = Login;
- Service.ClientCredentials.UserName.Password = Password;
- using (new OperationContextScope((IClientChannel)client))
- {
- HttpRequestMessageProperty requestProperty = new HttpRequestMessageProperty();
- string credentials = string.Format("{0}:{1}", _username, _password);
- requestProperty.Headers["Authorization"] = string.Format("Basic {0}", Convert.ToBase64String(UTF8Encoding.UTF8.GetBytes(credentials)));
- OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = requestProperty;
- data = client.GetData1();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement