Forum Discussion

cat_13700's avatar
cat_13700
Icon for Nimbostratus rankNimbostratus
Mar 17, 2010

C# set_active_partition error

I have big plans for the dashboard I will write to display a constantly refreshing panel of all the member of all my pools. I thought I'd better start by getting the iControlApp (from the video) tutorial working first. I run it, it connects, and it diplays one common pool, which I don't need. I want the "Alpha" partition pools. Scanning the forums, I learned I need to get my permissions and then set the active partition. At this point, the train wrecks.

 

 

Here's what I did:

 

 

First I added web references to Management.UserManagement and Management.Partition. Then up at the top of Form 1 of the demo app, i added these variables after the m_pool and m_poolMember variables:

 

 

        private ManagementUser.ManagementUserManagement m_manUser = new ManagementUser.ManagementUserManagement();  
          private ManagementPartition.ManagementPartition m_manPart = new ManagementPartition.ManagementPartition();

 

 

So far so good. Then down in Refresh_Pools function, I added the following just after "cb_pools.Items.Clear();" line:

 

 

            m_manUser.get_my_permission();  
                
              m_manPart.set_active_partition("Alpha");

 

 

I got a clean compile, but it breaks on either line (if i comment one or the other out) with an error: "The remote name could not be resolved: 'url_to_service'".

 

 

What am I missing? Code snippets or examples greatly appreciated!

 

3 Replies

  • If you are importing the WSDL files directly into Visual Studio, then you have to do some fun and games with the default URL that is specified. We make the URL in the WSDL files "http://url_to_service/iControl/iControlPortal.cgi" since we don't know (specifically in the standalone SDK) what the address of your BIG-IP is.

     

     

    I would highly recommend you use the iControl Assembly for .Net that we release here on DevCentral. It makes writing code a snap. Just download the iControlAssembly.dll from the iControl Assembly labs project under the Labs menu on DevCentral.

     

     

    Once you have that .dll on your system, in your project, select Add Reference and point to the iControlAssembly.dll.

     

     

    Next add the System.Web and System.Web.Services assemblies as references as well.

     

     

    Now all you need to do is create an iControl.Interfaces object, initialize it, and start making method calls.

     

     

    iControl.Interfaces m_interfaces = new iControl.Interfaces(); 
     bool bInitialized = m_interfaces.initialize("10.10.10.10", "admin_user", "admin_pass"); 
     if ( bInitialized ) 
     { 
       m_interfaces.ManagementUserManagement.get_my_permission(); 
       m_interfaces.ManagementPartition.set_active_partition("Alpha"); 
     }

     

     

    I guarantee this will make your life easier by using our assembly. It will also allow you to upgrade easier in the future when we make new assemblies available and you won't have to go in and refresh your defined references.

     

     

    Hope this helps...

     

     

    -Joe
  • Great to hear. Stick with the .net assembly and you'll be a happy camper!

     

     

    -Joe