File tree Expand file tree Collapse file tree 1 file changed +8
-11
lines changed
dotnet/src/dotnetcore/GxNetCoreStartup Expand file tree Collapse file tree 1 file changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -175,9 +175,9 @@ public void ConfigureServices(IServiceCollection services)
175175 {
176176 OpenTelemetryService . Setup ( services ) ;
177177
178- services . AddMvc ( option => option . EnableEndpointRouting = false ) ;
179-
180- RegisterControllerAssemblies ( services ) ;
178+ IMvcBuilder builder = services . AddMvc ( option => option . EnableEndpointRouting = false ) ;
179+
180+ RegisterControllerAssemblies ( builder ) ;
181181
182182 services . Configure < KestrelServerOptions > ( options =>
183183 {
@@ -267,16 +267,13 @@ public void ConfigureServices(IServiceCollection services)
267267 DefineCorsPolicy ( services ) ;
268268 }
269269
270- private void RegisterControllerAssemblies ( IServiceCollection services )
270+ private void RegisterControllerAssemblies ( IMvcBuilder mvcBuilder )
271271 {
272- IMvcBuilder mvcBuilder ;
272+
273273 if ( RestAPIHelpers . ServiceAsController ( ) && ! string . IsNullOrEmpty ( VirtualPath ) )
274- mvcBuilder = services . AddControllers ( options =>
275- {
276- options . Conventions . Add ( new SetRoutePrefix ( new RouteAttribute ( VirtualPath ) ) ) ;
277- } ) ;
278- else
279- mvcBuilder = services . AddControllers ( ) ;
274+ {
275+ mvcBuilder . AddMvcOptions ( options => options . Conventions . Add ( new SetRoutePrefix ( new RouteAttribute ( VirtualPath ) ) ) ) ;
276+ }
280277
281278 if ( RestAPIHelpers . JsonSerializerCaseSensitive ( ) )
282279 {
You can’t perform that action at this time.
0 commit comments