问题描述
嗨!
我试图用C#在MS DNS中添加A记录到域名,它已经完成了
来自网页使用此代码:
ManagementClass rr = new ManagementClass(@root\MicrosoftDNS",
" MicrosoftDNS_ResourceRecord",
new ObjectGetOptions(null,new TimeSpan(100),true));
string _ResellerDomainName =" mydomain.net。" ;;
object rrText =" web IN A 123.123.123.123;
rr.InvokeMethod(" CreateInstanceFromTextRepresentat ion,new
object [] {"。", _ResellerDomainName,rrText});
该记录已添加到域中,但即使它有效,我也会收到此错误:
System.Management .ManagementException:System.Management.ManagementObject.InvokeMethod(St ring
$)中的
System.Management.ManagementException.ThrowWithExt endsInfo(ManagementStatus
errorCode)的通用失败b $ b methodName,ManagementBaseObject inParameters,InvokeMethodOptions options)
at System.Management.ManagementObject.InvokeMethod(St ring methodName,
Object [] args)at WebDNS.DNSClass.AddRecord()在c:\documents和
settings\anders\vswebcache\webadmin\dnsclass.cs:li ne 30
所有权限必须是更正你的域名。
见过其他有这个错误但没有解决方案!
第30行是InvokeMethod
是什么导致了错误,我该怎么做才能解决它?
问候
Anders Aleborg
Hi!
Im trying to add a A record to a domain name in MS DNS with C#, it''s done
from a webpage with this code:
ManagementClass rr = new ManagementClass(@"root\MicrosoftDNS",
"MicrosoftDNS_ResourceRecord",
new ObjectGetOptions(null,new TimeSpan(100), true));
string _ResellerDomainName = "mydomain.net.";
object rrText = "web IN A 123.123.123.123";
rr.InvokeMethod("CreateInstanceFromTextRepresentat ion", new
object[] { ".", _ResellerDomainName, rrText});
The record is added to the domain but I get this error even thou it worked:
System.Management.ManagementException: Generic failure at
System.Management.ManagementException.ThrowWithExt endedInfo(ManagementStatus
errorCode) at System.Management.ManagementObject.InvokeMethod(St ring
methodName, ManagementBaseObject inParameters, InvokeMethodOptions options)
at System.Management.ManagementObject.InvokeMethod(St ring methodName,
Object[] args) at WebDNS.DNSClass.AddRecord() in c:\documents and
settings\anders\vswebcache\webadmin\dnsclass.cs:li ne 30
All permissions must be correct thou the domain is added.
Have seen other with this error but no solutions!
Line 30 is the InvokeMethod
What is causing the error and what can I do to solve it?
Regards
Anders Aleborg
推荐答案
这篇关于通用失败,wmi的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!