Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/324.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
用于管理配置文件的移动宽带C#接口_C#_Mobile_Com_Broadband - Fatal编程技术网

用于管理配置文件的移动宽带C#接口

用于管理配置文件的移动宽带C#接口,c#,mobile,com,broadband,C#,Mobile,Com,Broadband,我正在尝试将C#接口用于移动宽带API。下面的代码编译并显示所有COM方法,但代码执行不正确 MbnInterfaceManager mbnInfMgr = new MbnInterfaceManager(); IMbnConnectionProfile conProfile = (IMbnConnectionProfile)mbnInfMgr; string xmlBuff = conProfile.GetProfileXmlData(); 产生以下错误: Unable to cast C

我正在尝试将C#接口用于移动宽带API。下面的代码编译并显示所有COM方法,但代码执行不正确

MbnInterfaceManager mbnInfMgr = new MbnInterfaceManager();
IMbnConnectionProfile conProfile = (IMbnConnectionProfile)mbnInfMgr;

string xmlBuff = conProfile.GetProfileXmlData();
产生以下错误:

Unable to cast COM object of type 'System.__ComObject' to interfacetype 'MbnApi.IMbnConnectionProfile'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{DCBBBAB6-2010-4BBB-AAEE-338E368AF6FA}' failed due to the following error: No such interface supported(Exception from HRESULT: 0x80004002 (E_NOINTERFACE)). 看起来好像我需要指定接口,但似乎无法找到如何执行此操作

谁能告诉我怎么做吗?

通过调用或方法

例如


谢谢Jacob,我现在将尝试使用您的解决方案-非常感谢您花时间回答我的问题。我现在能够从每个接口读取xml文档的配置文件,但我无法编辑/修改,将引发一个异常,其中没有关于以下代码的详细信息。XDocument xdoc=XDocument.Parse(profArr[0].GetProfileXmlData()); xdoc.Add(新的XComment(“由系统修改”);你知道为什么会这样吗-谢谢
IMbnConnectionProfile Interface Method C# Signature

Delete              public void Delete();
GetProfileXmlData   public string GetProfileXmlData();
UpdateProfile       public void UpdateProfile( string strProfile);
MbnInterfaceManager mbnInfMgr = new MbnInterfaceManager();
IMbnInterfaceManager infManager = (IMbnInterfaceManager)mbnInfMgr;

//obtain the IMbnInterface passing interfaceID
string interfaceID = “{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}”;

IMbnInterface mbnInterface= infMgr.GetInterface(interfaceID);

MbnConnectionProfileManager mbnProfMgr = new MbnConnectionProfileManager();
IMbnConnectionProfileManager profileManager = 
                                  (IMbnConnectionProfileManager)mbnProfMgr;

IMbnConnectionProfile[] profArr = 
(IMbnConnectionProfile[])profileManager.GetConnectionProfiles(mbnInterface);