繁体   English   中英

调用Weblogic Web服务中的C#Winform(对操作方法的访问被拒绝)

[英]C# winform in call Weblogic web service (Access denied to operation method)

Help pls :(我的英语很差。我无法作进一步的解释。我无法作进一步的解释。我无法作进一步的解释。

App.config

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
  </configSections>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
  </startup>
  <system.net>
    <defaultProxy useDefaultCredentials="true" />
  </system.net>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding 
                 name="XXTG_HR_ROUTING_WS_PUBPortBinding" 
                 closeTimeout="00:01:00"
                 openTimeout="00:01:00" 
                 receiveTimeout="00:10:00" 
                 sendTimeout="00:01:00"
                 allowCookies="false" 
                 bypassProxyOnLocal="false" 
                 hostNameComparisonMode="StrongWildcard"
                 maxBufferPoolSize="524288" 
                 maxBufferSize="65536" 
                 maxReceivedMessageSize="65536"
                 textEncoding="utf-8" 
                 transferMode="Buffered" 
                 messageEncoding="Text"
                 >        
          <readerQuotas 
                maxDepth="32" 
                maxStringContentLength="8192" 
                maxArrayLength="16384"
                maxBytesPerRead="4096" 
                maxNameTableCharCount="16384" />
          <security mode="Transport">
            <transport 
                clientCredentialType="Basic" 
                proxyCredentialType="None"
                realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
        <binding name="XXTG_HR_ROUTING_WS_PUBPortBinding1" />
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://10.0.0.5:33021/xxtg_hr_routing_ws_pub/XXTG_HR_ROUTING_WS_PUB"
        binding="basicHttpBinding" bindingConfiguration="XXTG_HR_ROUTING_WS_PUBPortBinding1"
        contract="WS.XXTG_HR_ROUTING_WS_PUB" name="XXTG_HR_ROUTING_WS_PUBPort1" />
    </client>
  </system.serviceModel>
</configuration>

Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using WS_Data.WS;

namespace WS_Data
{
    public partial class Form1 : Form
    {

        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            WS.XXTG_HR_ROUTING_WS_PUBClient snn = new WS.XXTG_HR_ROUTING_WS_PUBClient();

            var clientCredentials = snn.ClientCredentials;

            clientCredentials.UserName.UserName = "snnuser";
            clientCredentials.UserName.Password = "snnpass";


            string getsnn = snn.leave_resp_list("percode").ToString();
            textBox1.Text = getsnn;
        }
    }
}

错误:我使用代理访问拒绝访问leaves_resp_list操作

在WCF绑定配置下尝试此操作

  <security mode="TransportCredentialOnly">
    <transport 
            clientCredentialType="Basic" 
            proxyCredentialType="None"
            realm="" />
  </security>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM