如何通过Web API使用WSUS远程API连接到WSUS服务器?

问题描述 投票:0回答:1

我正在尝试从ASP.NET Core 2.0中内置的Web应用程序远程连接到WSUS服务器。我正在使用Microsoft.UpdateServices.Administration.dll实现此目的。构建C#控制台应用程序并在程序集引用中使用相同的dll文件时,我能够建立与服务器的成功连接。我已经提到了这些类似的帖子,但尚未找到答案。-Is there RESTful webservice calls avaible in WSUS-How to make a SOAP call to WSUS Server

[[对不起,示例代码中没有保留缩进和正确的格式。]

下面是工作的控制台应用程序的示例代码:

using System;
using System.Reflection;
using Microsoft.UpdateServices.Administration;

namespace WsusRemoteConnectivityConsoleApp
{
  class Program
  {
      static void Main(string[] args)
      {
         IUpdateServer remoteServer = 
         AdminProxy.GetUpdateServer("WsusServer1",false,8530);
         Console.WriteLine(remoteServer.Name);
      }
  }
}

控制台应用程序中的预期输出以及实际输出为“ WsusServer1”。但是,在Web应用程序中使用同一行代码,我无法连接到WSUS服务器。我在此行中收到异常消息,指出“不支持所请求的安全协议”IUpdateServer remoteServer =AdminProxy.GetUpdateServer(“ WsusServer1”,false,8530);

感谢您的帮助。谢谢。

windows-update
1个回答
0
投票

如果已设置SSL,则应使用:

AdminProxy.GetUpdateServer("WsusServer1",true,8531);
© www.soinside.com 2019 - 2024. All rights reserved.