public IRegisteredObject CreateObject(string appId, Type type, string virtualPath, string physicalPath, bool failIfExists, bool throwOnError) { if (appId == null) { throw new ArgumentNullException("appId"); } SimpleApplicationHost appHost = new SimpleApplicationHost(VirtualPath.CreateAbsolute(virtualPath), physicalPath); HostingEnvironmentParameters hostingParameters = null; if (throwOnError) { hostingParameters = new HostingEnvironmentParameters { HostingFlags = HostingEnvironmentFlags.ThrowHostingInitErrors }; } return this.CreateObjectInternal(appId, type, appHost, failIfExists, hostingParameters); }
internal IRegisteredObject CreateObjectWithDefaultAppHostAndAppId(string physicalPath, VirtualPath virtualPath, Type type, bool failIfExists, HostingEnvironmentParameters hostingParameters, out string appId) { IApplicationHost host; if (physicalPath == null) { HttpRuntime.ForceStaticInit(); ISAPIApplicationHost host2 = new ISAPIApplicationHost(virtualPath.VirtualPathString, null, true, null, hostingParameters.IISExpressVersion); host = host2; appId = host2.AppId; virtualPath = VirtualPath.Create(host.GetVirtualPath()); physicalPath = System.Web.Util.FileUtil.FixUpPhysicalDirectory(host.GetPhysicalPath()); } else { appId = this.CreateSimpleAppID(virtualPath, physicalPath, null); host = new SimpleApplicationHost(virtualPath, physicalPath); } string precompilationTargetPhysicalDirectory = hostingParameters.PrecompilationTargetPhysicalDirectory; if (precompilationTargetPhysicalDirectory != null) { BuildManager.VerifyUnrelatedSourceAndDest(physicalPath, precompilationTargetPhysicalDirectory); if ((hostingParameters.ClientBuildManagerParameter != null) && ((hostingParameters.ClientBuildManagerParameter.PrecompilationFlags & PrecompilationFlags.Updatable) == PrecompilationFlags.Default)) { appId = appId + "_precompile"; } else { appId = appId + "_precompile_u"; } } return this.CreateObjectInternal(appId, type, host, failIfExists, hostingParameters); }
internal ObjectHandle CreateInstanceInNewWorkerAppDomain(Type type, string appId, VirtualPath virtualPath, string physicalPath) { IApplicationHost appHost = new SimpleApplicationHost(virtualPath, physicalPath); HostingEnvironmentParameters hostingParameters = new HostingEnvironmentParameters { HostingFlags = HostingEnvironmentFlags.HideFromAppManager }; return this.CreateAppDomainWithHostingEnvironmentAndReportErrors(appId, appHost, hostingParameters).CreateInstance(type.AssemblyQualifiedName); }