@@ -32,7 +32,10 @@ public class WebServer: AutoContext<WebServer>
3232 private readonly ExecutionContext _executionContext ;
3333 private WebApplication _app ;
3434 private readonly List < ( IRuntimeContextInstance Target , string MethodName ) > _middlewares = new List < ( IRuntimeContextInstance Target , string MethodName ) > ( ) ;
35+
3536 private string _contentRoot = null ;
37+ private string _wwwRoot ;
38+
3639 private bool _useStaticFiles = false ;
3740 private bool _useWebSockets = false ;
3841 private ( IRuntimeContextInstance Target , string MethodName ) ? _exceptionHandler = null ;
@@ -79,7 +82,8 @@ private void ConfigureApp()
7982 {
8083 var appOptions = new WebApplicationOptions
8184 {
82- ContentRootPath = _contentRoot ?? "."
85+ ContentRootPath = _contentRoot ,
86+ WebRootPath = _wwwRoot
8387 } ;
8488
8589 var builder = WebApplication . CreateBuilder ( appOptions ) ;
@@ -186,11 +190,17 @@ public void SetRequestsHandler(IRuntimeContextInstance target, string methodName
186190 public void SetExceptionsHandler ( IRuntimeContextInstance target , string methodName )
187191 => _exceptionHandler = ( target , methodName ) ;
188192
189- [ ContextMethod ( "УстановитьКорневойПутьСодержимого " , "SetContentRoot " ) ]
193+ [ ContextMethod ( "УстановитьКаталогСервера " , "SetServerDir " ) ]
190194 public void SetContentRoot ( IValue path )
191195 {
192196 _contentRoot = path . AsString ( ) ;
193197 }
198+
199+ [ ContextMethod ( "УстановитьКорневойПуть" , "SetWebRoot" ) ]
200+ public void SetWebRoot ( IValue path )
201+ {
202+ _wwwRoot = path . AsString ( ) ;
203+ }
194204
195205 [ ContextMethod ( "ИспользоватьСтатическиеФайлы" , "UseStaticFiles" ) ]
196206 public void UseStaticFiles ( )
0 commit comments