如何从远程 Windows 计算机检索计算机名称?

2024-02-02

我正在尝试找到一种从 C# 中的 IP 地址检索计算机名称的方法,但所有答案都在线标记为检索计算机名称或计算机名称actually获取主机名,而不是计算机名。如果您转到“控制面板”>“系统”,该菜单中有一个属性“计算机名称”...我正在远程计算机上查找该值。 AFAIK,主机名将 =full计算机名称(如果没有 DNS 映射)。问题是我正在使用的这些服务器确实有 DNS 映射,因此主机名返回它们的 DNS 地址。

如果我说错了什么,请随时纠正我的技术细节,但问题仍然存在。

我试过这个:

IPHostEntry hostEntry = Dns.GetHostEntry(_ip);

_hostname = hostEntry.HostName;

但显然返回主机名,而不是计算机名称。我还可以满足于返回“完整计算机名称”属性,然后简单地删除字符串中不需要的部分以显示“计算机名称”。

另外,如果您知道如何使用 PowerShell 执行此操作,我也可以使用您的帮助。无论如何,我在我的应用程序中托管 PowerShell 引擎...所以可以简单地将您的命令传递到PowerShellInstance.AddScript(_yourCommandHere);并将其返回返回到我的应用程序中。

请告知是否可以这样做。

@丹尼尔A怀特 编辑:这如何与列出的答案重复?那篇文章中的答案确切地说了我发布的内容problem对于这个问题。不,这不是重复的,因为我不是在寻找主机名。我在OP中特别告诉过你,我wasn't寻找那个,他们并没有问我要问的东西。如果无法从 .NET 中的 IP 获取计算机名称,那么就用它来回答问题。

来自“重复”:

嗯,并不是每个 IP 地址都有名称。但是,给定 IPAddress,您可以使用 >Dns.GetHostEntry 尝试解析它。另请注意,如果它是 NAT > 路由器,您将获得路由器的 IP 地址而不是其实际的 > 计算机。

看看我的OP....GetHostEntry 不起作用。这就是我花时间写下这篇文章的全部原因。

thanks

双重编辑:培根有一个关于如何做到这一点的答案;这篇文章被锁定是因为有人没有花时间真正阅读我写的内容。由于它已被锁定,您也无法给出更好的答案。但这是我的做法,将其保存在这里以供将来参考:

        //declare a string to be our machinename
        string machineName;
        //declare a string which we will pass into powershell later as script
        //assigns the hostname or IP
        string getComputer = "$ip = " + "\"" + ip + "\"" + "\r\n";
        //add to the string this, which gets the Win32_ComputerSystem.. @BACON knew what I was after
        //we pipe that back using |select -expand Name
        getComputer += "get-wmiobject -class Win32_ComputerSystem -property Name -ComputerName " + "$ip " +
            "|select -expand Name";
        //create a powershell instance using
        using (PowerShell PowerShellInstance = PowerShell.Create())
        {
            //add the script into our instance of ps
            PowerShellInstance.AddScript(getComputer);
            //instantiate a collection to house our output from PS
            //you could also probably just instantiate a PSObject instead of a collection.. but this might be useful if modified to get an array of computer names... and this is how I did it so can't verify
            Collection<PSObject> psOutput;
            //assign psOutput from .Invoke() method
            psOutput = PowerShellInstance.Invoke();

            //you could trim this loop and get rid of it for only one IP
            foreach (var item in psOutput)
            {
               //machineName = MachineName||ComputerName string NOT hostname
                machineName = item.BaseObject.ToString();
            }
        }

哦,根据评论中的培根,您必须允许 WMI 通过 Windows 防火墙才能正常工作。它对我来说非常有效。


重新构建我的评论作为答案......

想象一下我们有一个interface像这样...

namespace SO56585341
{
    public interface IComputerInfoSource
    {
        string GetComputerName();
    }
}

有几种方法可以实现此目的以获取机器名称本地计算机。最简单的就是返回值Environment.MachineName财产 https://learn.microsoft.com/dotnet/api/system.environment.machinename...

namespace SO56585341
{
    public class EnvironmentClassComputerInfoSource : IComputerInfoSource
    {
        public string GetComputerName()
        {
            return System.Environment.MachineName;
        }
    }
}

您还可以使用Environment.GetEnvironmentVariable() method https://learn.microsoft.com/dotnet/api/system.environment.getenvironmentvariable#System_Environment_GetEnvironmentVariable_System_String_检索的值%ComputerName%环境变量...

namespace SO56585341
{
    public class EnvironmentVariableComputerInfoSource : IComputerInfoSource
    {
        public string GetComputerName()
        {
            return System.Environment.GetEnvironmentVariable("ComputerName");
        }
    }
}

You can p/invoke https://learn.microsoft.com/dotnet/standard/native-interop/pinvoke the GetComputerName()Windows API函数 https://learn.microsoft.com/windows/win32/api/winbase/nf-winbase-getcomputernamew,这是什么Environment.MachineName does 幕后 https://referencesource.microsoft.com/#mscorlib/system/environment.cs,be0b5c103d248dce...

using System.Runtime.InteropServices;
using System.Text;

namespace SO56585341
{
    public class WinApiComputerInfoSource : IComputerInfoSource
    {
        private const int MAX_COMPUTERNAME_LENGTH = 15;

        [DllImport("Kernel32.dll", CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Auto, SetLastError = true)]
        private static extern bool GetComputerName(
            StringBuilder lpBuffer,
            ref int nSize
        );

        public string GetComputerName()
        {
            int maxCapacity = MAX_COMPUTERNAME_LENGTH + 1;
            StringBuilder nameBuilder = new StringBuilder(maxCapacity, maxCapacity);

            if (!GetComputerName(nameBuilder, ref maxCapacity))
            {
                // TODO: Error handling...
                throw new System.ComponentModel.Win32Exception();
            }

            return nameBuilder.ToString();
        }
    }
}

您可以使用 WMI 来检索Name单例的属性Win32_ComputerSystem class https://learn.microsoft.com/windows/win32/cimwin32prov/win32-computersystem。您可以通过实例化来做到这一点ManagementClass https://learn.microsoft.com/dotnet/api/system.management.managementclass实例为Win32_ComputerSystem类和调用GetInstances() https://learn.microsoft.com/dotnet/api/system.management.managementclass.getinstances在它上面检索包含唯一实例的数组...

using System.Linq;
using System.Management;

namespace SO56585341
{
    public class WmiClassComputerInfoSource : IComputerInfoSource
    {
        public string GetComputerName()
        {
            using (ManagementClass computerSystemClass = new ManagementClass("Win32_ComputerSystem"))
            using (ManagementObjectCollection computerSystemCollection = computerSystemClass.GetInstances())
            using (ManagementObject computerSystem = computerSystemCollection.Cast<ManagementObject>().Single())
                return (string) computerSystem["Name"];
        }
    }
}

...或者通过创建一个ManagementObjectSearcher https://learn.microsoft.com/dotnet/api/system.management.managementobjectsearcher并用它来Get() https://learn.microsoft.com/dotnet/api/system.management.managementobjectsearcher.get孤独的Win32_ComputerSystem实例...

using System.Linq;
using System.Management;

namespace SO56585341
{
    public class WmiSearcherComputerInfoSource : IComputerInfoSource
    {
        public string GetComputerName()
        {
            ObjectQuery computerSystemQuery = new SelectQuery("Win32_ComputerSystem");

            using (ManagementObjectSearcher computerSystemSearcher = new ManagementObjectSearcher(computerSystemQuery))
            using (ManagementObjectCollection computerSystemCollection = computerSystemSearcher.Get())
            using (ManagementObject computerSystem = computerSystemCollection.Cast<ManagementObject>().Single())
                return (string) computerSystem["Name"];
        }
    }
}

最后,上述所有方法返回的值似乎最终都存储在注册表中,因此如果您不介意依赖该实现细节,您可以直接从那里检索它......

using Microsoft.Win32;

namespace SO56585341
{
    public class RegistryComputerInfoSource : IComputerInfoSource
    {
        public string GetComputerName()
        {
            // See also @"SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName\"
            // https://www.oreilly.com/library/view/windows-nt-workstation/9781565926134/10_chapter-07.html
            const string valueParentKeyPath = @"SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName\";

            using (RegistryKey parentKey = Registry.LocalMachine.OpenSubKey(valueParentKeyPath, false))
                return (string) parentKey.GetValue("ComputerName");
        }
    }
}

至于从 a 获取相同的值远程计算机尽管需要进行最少的调整,但只有上面的最后三个实现可以工作。首先,只是为了完成这个IComputerInfoSource例如,让我们创建一个abstract保存远程计算机名称/地址“参数”的类...

namespace SO56585341
{
    public abstract class RemoteComputerInfoSource : IComputerInfoSource
    {
        public string RemoteNameOrIp
        {
            get;
        }

        protected RemoteComputerInfoSource(string nameOrIp)
        {
            RemoteNameOrIp = nameOrIp ?? throw new System.ArgumentNullException(nameof(nameOrIp));  
        }

        public abstract string GetComputerName();
    }
}

检索Win32_ComputerSystem实例通过ManagementClass只是显式地传递它一个问题ManagementPath https://learn.microsoft.com/dotnet/api/system.management.managementpath这也指定了NamespacePath https://learn.microsoft.com/dotnet/api/system.management.managementpath.namespacepath and Server https://learn.microsoft.com/dotnet/api/system.management.managementpath.server...

using System.Linq;
using System.Management;

namespace SO56585341
{
    public class RemoteWmiClassComputerInfoSource : RemoteComputerInfoSource
    {
        public RemoteWmiClassComputerInfoSource(string nameOrIp)
            : base(nameOrIp)
        {
        }

        public override string GetComputerName()
        {
            ManagementPath computerSystemPath = new ManagementPath() {
                ClassName = "Win32_ComputerSystem",
                NamespacePath = @"root\cimv2",
                Server = RemoteNameOrIp
            };

            using (ManagementClass computerSystemClass = new ManagementClass(computerSystemPath))
            using (ManagementObjectCollection computerSystemCollection = computerSystemClass.GetInstances())
            using (ManagementObject computerSystem = computerSystemCollection.Cast<ManagementObject>().Single())
                return (string) computerSystem["Name"];
        }
    }
}

A ManagementObjectSearcher可以通过传递类似的ManagementPath包裹在一个ManagementScope https://learn.microsoft.com/dotnet/api/system.management.managementscope...

using System.Linq;
using System.Management;

namespace SO56585341
{
    public class RemoteWmiSearcherComputerInfoSource : RemoteComputerInfoSource
    {
        public RemoteWmiSearcherComputerInfoSource(string nameOrIp)
            : base(nameOrIp)
        {
        }

        public override string GetComputerName()
        {
            ManagementScope computerSystemScope = new ManagementScope(
                new ManagementPath() {
                    NamespacePath = @"root\cimv2",
                    Server = RemoteNameOrIp
                }
            );
            ObjectQuery computerSystemQuery = new SelectQuery("Win32_ComputerSystem");

            using (ManagementObjectSearcher computerSystemSearcher = new ManagementObjectSearcher(computerSystemScope, computerSystemQuery))
            using (ManagementObjectCollection computerSystemCollection = computerSystemSearcher.Get())
            using (ManagementObject computerSystem = computerSystemCollection.Cast<ManagementObject>().Single())
                return (string) computerSystem["Name"];
        }
    }
}

查询远程注册表只需要额外调用OpenRemoteBaseKey() https://learn.microsoft.com/dotnet/api/microsoft.win32.registrykey.openremotebasekey获取远程配置单元根的句柄...

using Microsoft.Win32;

namespace SO56585341
{
    public class RemoteRegistryComputerInfoSource : RemoteComputerInfoSource
    {
        public RemoteRegistryComputerInfoSource(string nameOrIp)
        : base(nameOrIp)
        {
        }

        public override string GetComputerName()
        {
            // See also @"SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName\"
            // https://www.oreilly.com/library/view/windows-nt-workstation/9781565926134/10_chapter-07.html
            const string valueParentKeyPath = @"SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName\";

            using (RegistryKey baseKey = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, RemoteNameOrIp))
            using (RegistryKey parentKey = baseKey.OpenSubKey(valueParentKeyPath, false))
                return (string) parentKey.GetValue("ComputerName");
        }
    }
}

如果将上述所有代码编译到项目中,则可以使用以下内容Program类来测试它...

using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;

namespace SO56585341
{
    public static class Program
    {
        private const string TestHost = "127.0.0.1";

        public static void Main()
        {
            // Get all non-abstract classes in the executing assembly that implement IComputerInfoSource
            IEnumerable<Type> computerInfoSourceTypes = Assembly.GetExecutingAssembly().GetTypes()
                .Where(type => type.IsClass && !type.IsAbstract && typeof(IComputerInfoSource).IsAssignableFrom(type));

            // For each constructor in each candidate class...
            foreach (Type computerInfoSourceType in computerInfoSourceTypes)
                foreach (ConstructorInfo constructor in computerInfoSourceType.GetConstructors())
                {
                    ParameterInfo[] constructorParameters = constructor.GetParameters();
                    object[] instanceParameters;

                    // If the constructor takes no parameters...
                    if (!constructorParameters.Any())
                        instanceParameters = Array.Empty<object>();
                    // ...or a single string parameter...
                    else if (constructorParameters.Length == 1 && constructorParameters[0].ParameterType == typeof(string))
                        instanceParameters = new object[1] { TestHost };
                    // ...otherwise skip this constructor
                    else
                        continue;

                    // Instantiate the class using the constructor parameters specified above
                    IComputerInfoSource computerInfoSource = (IComputerInfoSource) constructor.Invoke(instanceParameters);
                    string result;

                    try
                    {
                        result = computerInfoSource.GetComputerName();
                    }
                    catch (Exception ex)
                    {
                        result = ex.ToString();
                    }

                    Console.WriteLine(
                        "new {0}({1}).{2}(): \"{3}\"",
                        computerInfoSourceType.Name,
                        string.Join(
                            ", ",
                            instanceParameters.Select(value => $"\"{value}\"")
                        ),
                        nameof(IComputerInfoSource.GetComputerName),
                        result
                    );
                }
        }
    }
}

我发现这段代码是否有效TestHost设置为计算机名称、CNAME 或 IP 地址。请注意,Remote*ComputerInfoSource课程将会失败,如果...

  • 适当的服务(RemoteRegistry or Winmgmt) 未在远程计算机上运行,​​或者...
  • 适当的防火墙规则(例如WMI-WINMGMT-In-TCP) 未在远程计算机上启用,或者...
  • 该代码不是以具有访问远程服务权限的用户身份运行的。

至于PowerShell,应该能够移植以下代码any来自 C# 的上述方法(直接翻译或使用 PowerShell 的便利)并将它们包装在对Invoke-Command https://learn.microsoft.com/powershell/module/microsoft.powershell.core/invoke-command因为该代码将在远程计算机本地执行。例如...

Invoke-Command -ComputerName $nameOrIp -ScriptBlock { $Env:COMPUTERNAME }

...or...

Invoke-Command -ComputerName $nameOrIp -ScriptBlock {
    # See also 'HKLM:\SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName\'
    # https://www.oreilly.com/library/view/windows-nt-workstation/9781565926134/10_chapter-07.html
    Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName\' -Name 'ComputerName'
}

PowerShell 还具有Get-WmiObject https://learn.microsoft.com/powershell/module/microsoft.powershell.management/get-wmiobject...

Get-WmiObject   -Class 'Win32_ComputerSystem' -ComputerName $nameOrIp -Property 'Name'

...and Get-CimInstance https://learn.microsoft.com/powershell/module/cimcmdlets/get-ciminstancecmdlet...

Get-CimInstance -Class 'Win32_ComputerSystem' -ComputerName $nameOrIp -Property 'Name'

...这使得使用 WMI 变得更加容易。一般来说,我建议使用 WMI因为它很容易从 C# 和 PowerShell 中用于本地和远程查询,并且它的存在正是为了检索系统详细信息,而无需了解底层 API 调用或数据表示。

请注意,当使用Invoke-Command or Get-CimInstancecmdlet 表示WinRM服务必须在远程计算机上运行并且具有适当的防火墙规则(例如WINRM-HTTP-In-TCP-NoScope) 必须启用。此外,当将 IP 地址传递给-ComputerName该地址的任一 cmdlet 的参数必须与以下值匹配WSMan:\localhost\Client\TrustedHosts https://learn.microsoft.com/powershell/module/microsoft.wsman.management/about/about_wsman_provider。如果你需要通过IP地址扫描整个网络我测试发现TrustedHosts接受*通配符,但不是子网掩码、CIDR 表示法或?通配符。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何从远程 Windows 计算机检索计算机名称? 的相关文章

  • 构造函数中显式关键字的使用

    我试图了解 C 中显式关键字的用法 并查看了这个问题C 中的explicit关键字是什么意思 https stackoverflow com questions 121162 但是 那里列出的示例 实际上是前两个答案 对于用法并不是很清楚
  • 如何配置 WebService 返回 ArrayList 而不是 Array?

    我有一个在 jax ws 上实现的 java Web 服务 此 Web 服务返回用户的通用列表 它运行得很好 Stateless name AdminToolSessionEJB RemoteBinding jndiBinding Admi
  • 从多个类访问串行端口

    我正在尝试使用串行端口在 arduino 和 C 程序之间进行通信 我对 C 编程有点陌生 该程序有多种用户控制形式 每一个都需要访问串口来发送数据 我需要做的就是从每个类的主窗体中写入串行端口 我了解如何设置和写入串行端口 这是我的 Fo
  • IronPython:没有名为 json 的模块

    我安装了 IronPython 我的 python 文件如下所示 import sys print sys version import json 运行它的代码 var p Python CreateEngine var scope p C
  • 当前的 c++ 工作草案与当前标准有何不同

    通过搜索该标准的 PDF 版本 我最终找到了这个链接C 标准措辞草案 http www open std org jtc1 sc22 wg21 docs papers 2012 n3376 pdf从 2011 年开始 我意识到我可以购买最终
  • 已达到网络 BIOS 命令限制

    我的 ASP Net 应用程序从另一台 Windows 服务器上的共享文件夹获取文件 当请求增加时 我收到以下错误 The network BIOS command limit has been reached 我已按照以下步骤操作微软 K
  • C 语言中 =+(等于加)是什么意思?

    我碰到 与标准相反 今天在一些 C 代码中 我不太确定这里发生了什么 我在文档中也找不到它 In ancientC 版本 相当于 它的残余物与最早的恐龙骨头一起被发现 例如 B 引入了广义赋值运算符 使用x y to add y to x
  • 即使手动设置显示环境变量后,WSL Ubuntu 也会显示“错误:无法打开显示”

    我在 WSL Ubuntu 上使用 g 我使用 git 克隆了 GLFW 存储库 使用了ccmake命令配置并生成二进制文件 然后使用make在 build 目录中最终创建 a文件 我安装了所有OpenGL相关的库 usr ld 我不记得我
  • 基于xsd模式生成xml(使用.NET)

    我想根据我的 xsd 架构 cap xsd 生成 xml 文件 我找到了这篇文章并按照说明进行操作 使用 XSD 文件生成 XML 文件 https stackoverflow com questions 6530424 generatin
  • C# 中条件编译符号的编译时检查(参见示例)?

    在 C C 中你可以这样做 define IN USE 1 define NOT IN USE 1 define USING system 1 system 1 IN USE 进而 define MY SYSTEM IN USE if US
  • Tkinter - 浮动窗口 - 调整大小

    灵感来自this https stackoverflow com a 22424245 13629335问题 我想为我的根窗口编写自己的调整大小函数 但我刚刚注意到我的代码显示了一些性能问题 如果你快速调整它的大小 你会发现窗口没有像我希望
  • 当模板类不包含可用的成员函数时,如何在编译时验证模板参数?

    我有以下模板struct template
  • 如何挤出平面 2D 网格并赋予其深度

    我有一组共面 连接的三角形 即二维网格 现在我需要将其在 z 轴上挤出几个单位 网格由一组顶点定义 渲染器通过与三角形数组匹配来理解这些顶点 网格示例 顶点 0 0 0 10 0 0 10 10 0 0 10 0 所以这里我们有一个二维正方
  • 尚未处理时调用 Form 的 Invoke 时出现 ObjectDisposeException

    我们得到一个ObjectDisposedException从一个电话到Invoke在尚未处理的表格上 这是一些演示该问题的示例代码 public partial class Form2 Form void Form2 Load object
  • 是否可以有一个 out ParameterExpression?

    我想定义一个 Lambda 表达式out范围 有可能做到吗 下面是我尝试过的 C Net 4 0 控制台应用程序的代码片段 正如您在 procedure25 中看到的 我可以使用 lambda 表达式来定义具有输出参数的委托 但是 当我想使
  • 剪贴板在 .NET 3.5 和 4 中的行为有所不同,但为什么呢?

    我们最近将一个非常大的项目从 NET Framework 3 5 升级到 4 最初一切似乎都工作正常 但现在复制粘贴操作开始出现错误 我已经成功制作了一个小型的可复制应用程序 它显示了 NET 3 5 和 4 中的不同行为 我还找到了一种解
  • 使用 C# 从 DateTime 获取日期

    愚蠢的问题 给定日期时间中的日期 我知道它是星期二 例如我如何知道它的 tue 2 和 mon 1 等 Thanks 您正在寻找星期几 http msdn microsoft com en us library system datetim
  • WinRT 定时注销

    我正在开发一个 WinRT 应用程序 要求之一是应用程序应具有 定时注销 功能 这意味着在任何屏幕上 如果应用程序空闲了 10 分钟 应用程序应该注销并导航回主屏幕 显然 执行此操作的强力方法是在每个页面的每个网格上连接指针按下事件 并在触
  • 如何为 Windows toast 注册协议?

    如何注册 Windows toast 协议 样本中来自https blogs msdn microsoft com tiles and toasts 2015 07 02 adaptive and interactive toast not
  • 使用 Crypto++ 获取 ECDSA 签名

    我必须使用 Crypto 在变量中获取 ECDSA 签名 我在启动 SignMessage 后尝试获取它 但签名为空 我怎样才能得到它 你看过 Crypto wiki 吗 上面有很多东西椭圆曲线数字签名算法 http www cryptop

随机推荐

  • 在 GO 中获取传入的 TTL

    我正在为我正在进行的一个小项目而苦苦挣扎 我想在 GO 中实现功能 允许我在传出 UDP 数据包上设置 IP 标头 TTL 然后发送该数据包并查看另一端收到的 TTL 我尝试使用 net 库提供的多个连接 但到目前为止没有成功 我可以设置
  • 逐行读取输入

    如何在Java中逐行读取输入 我搜索过 到目前为止我有这个 import java util Scanner public class MatrixReader public static void main String args Sca
  • 在 Android ActionBar 上设置导航图标

    因此 我正在努力将 ActionBarSherlock 和导航抽屉添加到以前实现自定义 写得很差 操作栏 的项目中 某些活动不使用片段和活动的后台堆栈进行导航 而是显示和隐藏不同的布局 也就是说 假设我处于列表模式 然后选择一个按钮进入编辑
  • CQRS 项目是否需要像 NServiceBus 这样的消息传递框架?

    过去 6 个月的学习曲线充满挑战 CQRS 和 DDD 是罪魁祸首 这很有趣 我们的项目已经完成了 1 2 我还没有时间深入研究的领域是消息传递框架 目前我不使用 DTC 因此如果我的读取模型未更新 那么很可能会出现读取和写入数据库之间的不
  • MediaCodec 给出了 storeMetaDataInBuffers 跟踪错误

    在 Android 中通过 MediaCodec 进行编码时 我在 logcat 上遇到了下一个错误 实际的编码工作正常并且输出生成正确 所以我无法真正理解为什么我得到这个跟踪 这是无害的错误跟踪 还是我遗漏了什么 E ACodec 643
  • 使用 PowerShell 授权 Office365 逻辑应用 API 连接

    尝试设置一堆支持Azure功能等的逻辑应用程序 概念是利用ML Azure功能 逻辑应用程序等来设置自动邮件系统 一切都是使用 ADO Git 和 CD CI 管道进行部署的 但我们在 Office365 连接器方面遇到了问题 它在创建后需
  • 即使应用程序似乎未安装,也会失败 [INSTALL_FAILED_UPDATE_INCOMPATIBLE]

    当尝试将我的应用程序部署到 Android 设备时 我收到以下错误 Deployment failed because of an internal error Failure INSTALL FAILED UPDATE INCOMPATI
  • Glyphicon 在 bootstrap 版本 4.1 及更高版本中不起作用

    我试图展示一个搜索图标形式 但唯一的按钮显示没有字形
  • 将数据文件添加到python项目setup.py

    我有一个这样的项目 CHANGES txt LICENSE MANIFEST in docs index rst negar Negar py Virastar py Virastar pyc init py data init py un
  • 随机长长生成器 C++ [关闭]

    很难说出这里问的是什么 这个问题是含糊的 模糊的 不完整的 过于宽泛的或修辞性的 无法以目前的形式得到合理的回答 如需帮助澄清此问题以便重新打开 访问帮助中心 help reopen questions 生成随机数的解决方案是什么long
  • 验证 struts 2 中的双字段

    我的 struts 2 表单之一中有一个 长度 字段 length 的数据类型是 double 我已经在 XML 文件中应用了 双重 验证 但是当我在 长度 文本字段中键入字母时 它显示错误消息为 Invalid field value f
  • 我搞砸了我的 System_server 服务吗?

    我的手机正在产生不间断的 Log d 输出 以下内容不断重复每秒1200次 04 25 15 58 04 883 1542 5012 D NetworkStatsCollection getHistory mUID 10266 isVide
  • antlr4:如何知道在给定上下文的情况下选择了哪个替代方案

    假设有一个关于 类型 的规则 它可以是预定义类型 由 IDENTIFIER 引用 或 typeDescriptor type IDENTIFIER typeDescriptor 在我的程序中 我有一个 typeContext ctx 的实例
  • 垂直对齐:基线有什么用?

    我以为我了解 CSS 但我现在需要向某人解释一些事情 但我发现我做不到 我的问题基本上可以归结为 为什么vertical align baseline当同一行中有其他对齐时被忽略 示例 如果第二个跨度有vertical align bott
  • 实体框架4:我的load方法和IsLoaded属性在哪里?

    我正在使用 EF4 并且在我的类中使用 System Data Entity dll 但是 我看不到实体的导航属性的加载方法 我怎样才能访问这个方法 我正在做的是创建 NET 的 e 4 0 项目 从数据库创建我的 edmx 右键单击模型
  • 在 Android studio 项目上找不到参数的方法 test()

    在我的 Android 应用程序中 我想排除包中的一些测试用例 以便我使用test任务在build gradle文件 例如 apply plugin com android library test exclude calltest Sum
  • 无法生成云端点类

    亲爱的程序员朋友们 我对编程非常陌生 我正在遵循有关使用应用程序引擎后端教程的教程 然而我一路上遇到了一些问题 我已经设置了 App Engine 后端应用程序项目 创建了一个 CheckIn 实体类 之后 我按照说明创建一个名为 Chec
  • Oracle 存储过程出错

    当尝试创建此存储过程时 我收到错误 PLS 00428 此 SELECT 语句中需要 INTO 子句 Code CREATE OR REPLACE PROCEDURE FindDb P BookId IN BOOKMASTER BookId
  • 如何在 MATLAB 中动态访问结构体字段的字段?

    我对访问可能埋藏在包含结构深处的任意数量的级别的字段的一般问题感兴趣 下面是使用两个级别的具体示例 说我有一个结构toplevel 我使用以下命令从 MATLAB 命令行定义它 midlevel bottomlevel foo toplev
  • 如何从远程 Windows 计算机检索计算机名称?

    我正在尝试找到一种从 C 中的 IP 地址检索计算机名称的方法 但所有答案都在线标记为检索计算机名称或计算机名称actually获取主机名 而不是计算机名 如果您转到 控制面板 gt 系统 该菜单中有一个属性 计算机名称 我正在远程计算机上