Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Activation / ServiceHostFactory.cs / 1 / ServiceHostFactory.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.ServiceModel.Activation { using System.Reflection; using System.Collections.ObjectModel; public class ServiceHostFactory : ServiceHostFactoryBase { CollectionreferencedAssemblies = new Collection (); internal void AddAssemblyReference(string assemblyName) { this.referencedAssemblies.Add(assemblyName); } public override ServiceHostBase CreateServiceHost(string constructorString, Uri[] baseAddresses) { if (!ServiceHostingEnvironment.IsHosted) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.Hosting_ProcessNotExecutingUnderHostedContext, "ServiceHostFactory.CreateServiceHost"))); } if (string.IsNullOrEmpty(constructorString)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.Hosting_ServiceTypeNotProvided))); } Type type = Type.GetType(constructorString, false); if (type == null) { foreach (string assemblyName in this.referencedAssemblies) { Assembly assembly = Assembly.Load(assemblyName); type = assembly.GetType(constructorString, false); if (type != null) break; } } if (type == null) { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); for (int i = 0; i < assemblies.Length; i++) { type = assemblies[i].GetType(constructorString, false); if (type != null) break; } } if (type == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.Hosting_ServiceTypeNotResolved, constructorString))); } return CreateServiceHost(type, baseAddresses); } protected virtual ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses) { return new ServiceHost(serviceType, baseAddresses); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- FocusChangedEventArgs.cs
- SelectionProviderWrapper.cs
- DriveNotFoundException.cs
- DataContractSet.cs
- EntityDataReader.cs
- TagPrefixInfo.cs
- FunctionImportElement.cs
- SByte.cs
- ScriptIgnoreAttribute.cs
- SqlCacheDependency.cs
- TextEditorLists.cs
- XPathNavigator.cs
- METAHEADER.cs
- DynamicDataResources.Designer.cs
- MimeTypePropertyAttribute.cs
- PartialCachingControl.cs
- ComplexLine.cs
- AutoResizedEvent.cs
- SQLDecimal.cs
- WorkItem.cs
- FrameworkElement.cs
- OracleNumber.cs
- EntityDataSource.cs
- MultiBinding.cs
- isolationinterop.cs
- ConvertEvent.cs
- PersonalizableAttribute.cs
- PropertyDescriptorGridEntry.cs
- InstanceLockedException.cs
- ConfigurationLocationCollection.cs
- HttpCachePolicy.cs
- TextEditorSelection.cs
- ISAPIWorkerRequest.cs
- ScrollData.cs
- SqlRecordBuffer.cs
- BamlLocalizationDictionary.cs
- QilList.cs
- SmuggledIUnknown.cs
- COAUTHINFO.cs
- SystemUdpStatistics.cs
- DefaultShape.cs
- GroupByExpressionRewriter.cs
- ScrollEvent.cs
- FixedSOMTable.cs
- DataSourceDesigner.cs
- CodeCatchClauseCollection.cs
- BinHexDecoder.cs
- ListBase.cs
- ReleaseInstanceMode.cs
- DataProviderNameConverter.cs
- Errors.cs
- WmpBitmapDecoder.cs
- FocusWithinProperty.cs
- MissingMethodException.cs
- OdbcDataReader.cs
- PrincipalPermission.cs
- GACMembershipCondition.cs
- StylusPointPropertyUnit.cs
- TextModifierScope.cs
- UnknownBitmapEncoder.cs
- PassportAuthenticationEventArgs.cs
- CqlErrorHelper.cs
- WorkflowOperationErrorHandler.cs
- ListBox.cs
- GridViewSelectEventArgs.cs
- DataTemplate.cs
- GlyphRun.cs
- Vector3DAnimationUsingKeyFrames.cs
- LinkConverter.cs
- TreeViewItem.cs
- ScriptServiceAttribute.cs
- DesignTimeResourceProviderFactoryAttribute.cs
- PersonalizationState.cs
- SendMailErrorEventArgs.cs
- XmlChildNodes.cs
- ExtensionQuery.cs
- PassportAuthentication.cs
- UnionCodeGroup.cs
- ReadOnlyDictionary.cs
- ADConnectionHelper.cs
- _HTTPDateParse.cs
- BindingElementExtensionElement.cs
- AssociationTypeEmitter.cs
- Table.cs
- XslNumber.cs
- DataColumnMapping.cs
- PropertyValue.cs
- ToolStripSeparatorRenderEventArgs.cs
- HexParser.cs
- TypeLoadException.cs
- SelectedPathEditor.cs
- XmlWriter.cs
- TemplateBindingExtension.cs
- HitTestParameters.cs
- PropertyStore.cs
- ISAPIRuntime.cs
- DataGridViewRowEventArgs.cs
- CharacterBufferReference.cs
- ControlPropertyNameConverter.cs
- DataBinder.cs