In-Place Compilation using ClientBuildManager.CompileFile

后端 未结 2 2001
故里飘歌
故里飘歌 2021-02-05 16:54

I\'m working on a website that I\'d like to use in-place compilation on in order to make the first hit faster. I\'d like to use the ClientBuildManager.CompileFile method to do

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-05 17:13

    Sam, the answer is a cross between David Ebbo's answer, and your original code.

    var buildParameter = new ClientBuildManagerParameter
       {
          PrecompilationFlags = PrecompilationFlags.Default,
       };
    var clientBuildManager = new ClientBuildManager(
       RootVirtualPath, RootPhysicalPath, null, buildParameter);
    ...
    clientBuildManager.CompileFile(relativeVirtualPath, callback);
    

    If you do what David Ebbo said and use this for the RootVirtualPath when constructing the ClientBuildManager:

    /LM/W3SVC/7/ROOT/

    you then have to pass in null for the RootPhysicalPath.

    That should get rid of the rest of the issues, and it should build to the same directory that IIS is looking for.

提交回复
热议问题