FineUI 官方论坛
标题:
【专业版】GetRequestIPMAC出现异常(Provider failure, COMException)
[打印本页]
作者:
todd
时间:
2014-12-1 17:20
标题:
【专业版】GetRequestIPMAC出现异常(Provider failure, COMException)
[attach]6879[/attach]
[attach]7558[/attach]
作者:
sanshi
时间:
2014-12-2 11:04
已确认问题出在这个函数中:GetRequestIPMAC,可能是 IIS 中 ASP.NET 进程的权限问题,但还未解决
附函数源码:
/// <summary>
/// 获取当前请求的服务器IP,以及相应的MAC地址
/// </summary>
/// <returns>[当前请求的服务器IP,MAC地址]</returns>
public string[] GetRequestIPMAC()
{
string[] result = new string[2];
string serverName = Page.Request.ServerVariables["SERVER_NAME"];
string requestServerIP = Page.Request.ServerVariables["LOCAL_ADDR"];
if (serverName == "localhost")
{
result[0] = "localhost";
}
else
{
result[0] = requestServerIP.ToLower();
ManagementClass mc = new ManagementClass("Win32_NetworkAdapterConfiguration");
ManagementObjectCollection moc = mc.GetInstances();
foreach (ManagementObject mo in moc)
{
try
{
if ((bool)mo["IPEnabled"] == true)
{
string[] IPAddresses = (string[])mo["IPAddress"];
if (IPAddresses.Length > 0)
{
for (int i = 0; i < IPAddresses.Length; i++)
{
if (IPAddresses[i] == requestServerIP)
{
result[1] = mo["MacAddress"].ToString().ToLower();
break;
}
}
}
if (!String.IsNullOrEmpty(result[1]))
{
break;
}
}
}
finally
{
mo.Dispose();
}
}
}
return result;
}
复制代码
作者:
sanshi
时间:
2014-12-11 16:20
刚才有客户也遇到这个问题,说是关闭服务器的 UAC 就行了,分享如下。
[attach]6925[/attach]
[attach]6926[/attach]
[attach]6928[/attach]
作者:
sanshi
时间:
2015-5-6 12:15
可以尝试的解决办法:
1. 首先执行命令行: iisreset
2. 将网站所属的应用程序池(App Pool)的 加载用户配置文件(Load User Profile)设为 true
[attach]7464[/attach]
[attach]7465[/attach]
参考:
https://social.msdn.microsoft.co ... forum=csharpgeneral
http://blogs.msdn.com/b/asiatech ... ofile-in-iis-7.aspx
http://www.avianwaves.com/Blog/e ... nstalled-Error.aspx
http://q.cnblogs.com/q/54160/
欢迎光临 FineUI 官方论坛 (https://fineui.com/bbs/)
Powered by Discuz! X3.4