private void removeVHost() { string IDStr = (string)Request["ID"]; int ID=-1; if (!Int32.TryParse(IDStr,out ID)) return; MasterServiceHostInstance oldVHost = new MasterServiceHostInstance(); oldVHost.ServiceHostID = ID; MasterServiceHostInstance newVHost = new MasterServiceHostInstance(); newVHost.ServiceHostID = ID; traversePath = DynamicTraversePath.getTraversePath(hostNameIdentifier, configName, ref configProxy, address, binding, user); try { int success = configProxy.receiveService(hostNameIdentifier, configName, null, null, null, null, null, oldVHost, newVHost, true, ConfigUtility.REMOVE_VHOST, traversePath, user); } catch { return; } return; }
protected override void OnLoad(EventArgs e) { Page.Form.DefaultFocus = DropDownListContracts.ClientID; Input.getHostData(IsPostBack, ViewState, out userid, out address, out user, out binding, out hostNameIdentifier, out configName, out version, out platform, out hoster, false); if (!IsPostBack) { ViewState["processing"] = false; action = Request["action"]; string idString = Request["HSID"]; string vidString = Request["SHID"]; SHID = Convert.ToInt32(vidString); if (vidString == null || vidString == "") Response.Redirect(ConfigSettings.PAGE_NODES,true); if (idString != null) HSID = Convert.ToInt32(idString); traversePath = DynamicTraversePath.getTraversePath(hostNameIdentifier, configName, ref configProxy, address, binding, user); compositeServiceData = configProxy.getServiceConfiguration(hostNameIdentifier, configName, ConfigUtility.CONFIG_LEVEL_BASIC, false, traversePath, user); serviceHosts = configProxy.getVirtualServiceHosts(hostNameIdentifier, configName, traversePath, user); serviceUsers = configProxy.getServiceUsers(hostNameIdentifier, configName, traversePath, user); serviceUsers.RemoveAll(delegate(ServiceUsers userExist) { return !userExist.LocalUser || userExist.Rights != ConfigUtility.CONFIG_CONNECTED_SERVICE_RIGHTS; }); if (compositeServiceData == null) { Response.Redirect(ConfigSettings.PAGE_NODES,true); } thisService = compositeServiceData[0].HostedServices.Find(delegate(HostedServices hsExist) { return hsExist.HostedServiceID == HSID; }); thisServiceHost = serviceHosts.Find(delegate(MasterServiceHostInstance mshExist) { return mshExist.ServiceHostID == SHID; }); if (thisServiceHost.HostEnvironment == ConfigUtility.HOSTING_ENVIRONMENT_IIS) { LabelVDirWarning.Text = "This is an IIS-Hosted Service. If you mark this endpoint as a BASE address (below), you must specify the exact virtual directory + filename for your .svc file, as this is what WCF will expect as a base address. Relative addresses for an IIS-hosted service, become " + "the virtual directory + /[.svcfilename]/path. For example, you can add a relative address to /myVdir/myservice.svc as /myVDir/myservice.svc/mynewendpoint."; LabelPortWarning.Text = "As an IIS-hosted service endpoint, typically this will be 80 for non-SSL services, and 443 for SSL services, unless you have otherwise configured your IIS site that hosts your service."; LabelPortWarning.ForeColor = System.Drawing.ColorTranslator.FromHtml("#FFFF99"); LabelVDirWarning.ForeColor = System.Drawing.ColorTranslator.FromHtml("#FFFF99"); } if (thisServiceHost.ServiceType.Equals(ConfigUtility.HOST_TYPE_NODE) || thisServiceHost.ServiceType.Equals(ConfigUtility.HOST_TYPE_NODE_DC)) RadioButtonListLoadBalanceType.Enabled=false; DropDownListEPB.Items.Clear(); for (int i = 0; i < compositeServiceData[0].EndpointBehaviorNames.Count; i++) { DropDownListEPB.Items.Add(new ListItem(compositeServiceData[0].EndpointBehaviorNames[i], compositeServiceData[0].EndpointBehaviorNames[i])); } if (DropDownListEPB.Items.Count == 0) { DropDownListEPB.Enabled = false; LabelEPB.Text = "No Endpoint Behaviors were initialized as part of your service startup procedure. Hence, you cannot select any endpoint behaviors at this time."; CheckBoxEPB.Enabled = false; } else { DropDownListEPB.Enabled = true; CheckBoxEPB.Enabled = true; } DropDownListIdentity.Items.Clear(); for (int i = 0; i < compositeServiceData[0].EndpointIdentityNames.Count; i++) { DropDownListIdentity.Items.Add(new ListItem(compositeServiceData[0].EndpointIdentityNames[i], compositeServiceData[0].EndpointIdentityNames[i])); } if (DropDownListIdentity.Items.Count == 0) { DropDownListEPB.Enabled = false; LabelIdentity.Text = "No Endpoint identities have been configured in the config file section <endpointIdentities>. Hence, you cannot select any endpoint identities at this time, default values will be used."; CheckBoxIdentity.Enabled = false; } ViewState["CompositeServiceData"] = compositeServiceData; ViewState["SHID"] = SHID; ViewState["HSID"] = HSID; ViewState["thisOldService"] = thisService; ViewState["thisService"] = thisService; ViewState["action"] = action; ViewState["serviceHosts"] = serviceHosts; ViewState["serviceUsers"] = serviceUsers; initRadioButtons(); narrowSelections(); if (!action.Equals(ConfigUtility.ADD_HOSTED_SERVICE)) getData(); else initData(); buildBindingLists(false); } else { UpdateMessageAzureLB.Text = ""; compositeServiceData = (List<ServiceConfigurationData>)ViewState["CompositeServiceData"]; SHID = (int)ViewState["SHID"]; HSID = (int)ViewState["HSID"]; serviceHosts = (List<MasterServiceHostInstance>)ViewState["serviceHosts"]; serviceUsers = (List<ServiceUsers>)ViewState["serviceUsers"]; thisOldService = (HostedServices)ViewState["thisOldService"]; thisService = (HostedServices)ViewState["thisService"]; action = (string)ViewState["action"]; thisServiceHost = serviceHosts.Find(delegate(MasterServiceHostInstance mshExist) { return mshExist.ServiceHostID == SHID; }); } TopNode.PostBackUrl = ConfigSettings.PAGE_NODES; ServiceVersion.Text = version; ServicePlatform.Text = platform; ServiceHoster.Text = hoster; TopNodeName.Text = hostNameIdentifier; ReturnLabel.Text = "<a class=\"Return\" href=\"" + ConfigSettings.PAGE_HOSTED_SERVICES + "?name=" + hostNameIdentifier + "&cfgSvc=" + configName + "&version=" + version + "&platform=" + platform + "&hoster=" + hoster + "&ID=" + SHID + "&hostname=" + thisServiceHost.HostName + "\">Return to Hosted Services for this Virtual Host</a>"; GetImageButton.runtimePoweredBy(platform, RuntimePlatform); if (action.Equals(ConfigUtility.ADD_HOSTED_SERVICE)) { Update.Enabled = false; Delete.Enabled = false; } else { Add.Enabled = false; } thisServiceHost = serviceHosts.Find(delegate(MasterServiceHostInstance mshExist) { return mshExist.ServiceHostID == SHID; }); LabelClassName.Text = thisServiceHost.ServiceImplementationClass; LabelVHostName.Text = thisServiceHost.HostName; }