G
Guest
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("CreateInstanceFromTextRepresentation", 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.ThrowWithExtendedInfo(ManagementStatus
errorCode) at System.Management.ManagementObject.InvokeMethod(String
methodName, ManagementBaseObject inParameters, InvokeMethodOptions options)
at System.Management.ManagementObject.InvokeMethod(String methodName,
Object[] args) at WebDNS.DNSClass.AddRecord() in c:\documents and
settings\anders\vswebcache\webadmin\dnsclass.cs:line 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
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("CreateInstanceFromTextRepresentation", 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.ThrowWithExtendedInfo(ManagementStatus
errorCode) at System.Management.ManagementObject.InvokeMethod(String
methodName, ManagementBaseObject inParameters, InvokeMethodOptions options)
at System.Management.ManagementObject.InvokeMethod(String methodName,
Object[] args) at WebDNS.DNSClass.AddRecord() in c:\documents and
settings\anders\vswebcache\webadmin\dnsclass.cs:line 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