public AspHandler(IWebHostEnvironment environment, string webRoot) { _environment = environment; _webRoot = webRoot; _scriptCache = new Dictionary <string, CompiledPage>(); AspHostConfiguration config = new AspHostConfiguration(); // config.Assemblies = AspHandlerConfiguration.Assemblies; // config.Trace = AspHandlerConfiguration.Trace; _aspHost = new AspHost(config); }
public AspHost(AspHostConfiguration config) { _config = config; //Configuration configuration = WebConfigurationManager.OpenWebConfiguration("~"); //SystemWebSectionGroup systemWeb = configuration.GetSectionGroup("system.web") as SystemWebSectionGroup; //if (systemWeb != null) //{ // _debug = systemWeb.Compilation.Debug; //} ScriptRuntimeSetup setup = new ScriptRuntimeSetup(); //if (_debug) //{ // setup.Options["FullFrames"] = ScriptingRuntimeHelpers.True; // setup.Options["Debug"] = ScriptingRuntimeHelpers.True; //} if (config.Trace) { setup.Options["Trace"] = ScriptingRuntimeHelpers.True; } string qualifiedname = typeof(VBScriptContext).AssemblyQualifiedName; setup.LanguageSetups.Add(new LanguageSetup( qualifiedname, "vbscript", new[] { "vbscript" }, new[] { ".vbs" })); _runtime = new ScriptRuntime(setup); //_runtime.LoadAssembly(typeof(global::Dlrsoft.VBScript.Runtime.BuiltInFunctions).Assembly); if (config != null && config.Assemblies != null) { foreach (Assembly a in config.Assemblies) { _runtime.LoadAssembly(a); } } _engine = _runtime.GetEngine("vbscript"); }