Controllers/InventoryWsvrController.cs
(开头部分) 10KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System.ServiceModel;
using System.Data;
using ServiceReference1;
using WebApplication1.Common;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
using System.Xml.Linq;
namespace WebApplication1.Controllers
{
[Serializable]
public class InventoryWsvrController : Controller
{
// GET: Inventory
public ActionResult Index(string findstr)
{
string _pc_name = System.Net.Dns.GetHostName().ToString().ToLower();
string address;
//创建绑定对象
var binding = new BasicHttpBinding();
binding.CloseTimeout = new TimeSpan(00, 01, 00);
binding.OpenTimeout = new TimeSpan(00, 01, 00);
binding.ReceiveTimeout = new TimeSpan(00, 10, 00);
binding.SendTimeout = new TimeSpan(00, 01, 00);
binding.MaxBufferPoolSize = 524288;
binding.MaxReceivedMessageSize = 2147483646;
//binding.UseDefaultWebProxy = true;
//binding.AllowCookies = false;
binding.ReaderQuotas.MaxDepth = 32;
binding.ReaderQuotas.MaxStringContentLength = 8192;
binding.ReaderQuotas.MaxArrayLength = 16384;
binding.ReaderQuotas.MaxBytesPerRead = 4096;
binding.ReaderQuotas.MaxNameTableCharCount = 16384;
//根据WebService的URL构建终端点对象,参数是提供的WEBSRV地址
if (_pc_name.ToLower().Contains("yu"))
{
address = "http://localhost:8087/Service1.asmx";
}
else
{
address = "http://localhost:8087/Service1.asmx";
}
var endpoint = new EndpointAddress(address);
//创建调用接口的工厂,注意这里的泛型只能传入接口 泛型接口的参数是WEBSVR里面定义的的类名+soap
var factory = new ChannelFactory<ServiceReference1.Service1Soap>(binding, endpoint);
//从工厂获取具体的调用实例
var callClient = factory.CreateChannel();
//调用具体的方法这里是getperson方法
#region-------返回dataset
//Task<ArrayOfXElement> tables = callClient.selectinventoryforDsAsync(findstr);
//Task<ServiceReference1.ArrayOfXElement> tables = callClient.ZipunZipSurrogateZipBYtesAsync(findstr);
后面还有 135 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读 AI
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
