-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Add IServerAddressesFeature support #4685
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Multiple IIS test failures? |
Yep, I missed something. But in general PR ready for review. |
src/IISIntegration/src/AspNetCoreModuleV2/CommonLib/BindingInformation.h
Outdated
Show resolved
Hide resolved
src/IISIntegration/src/AspNetCoreModuleV2/CommonLib/BindingInformation.h
Outdated
Show resolved
Hide resolved
src/IISIntegration/src/AspNetCoreModuleV2/InProcessRequestHandler/inprocessapplication.cpp
Outdated
Show resolved
Hide resolved
src/IISIntegration/src/AspNetCoreModuleV2/RequestHandlerLib/environmentvariablehelpers.h
Outdated
Show resolved
Hide resolved
src/IISIntegration/src/Microsoft.AspNetCore.Server.IIS/Core/IISServerSetupFilter.cs
Outdated
Show resolved
Hide resolved
src/IISIntegration/src/Microsoft.AspNetCore.Server.IISIntegration/IISSetupFilter.cs
Outdated
Show resolved
Hide resolved
src/IISIntegration/test/WebSites/OutOfProcessWebSite/Startup.cs
Outdated
Show resolved
Hide resolved
Failures are AuthSamples tests |
@@ -84,6 +83,9 @@ public Task StartAsync<TContext>(IHttpApplication<TContext> application, Cancell | |||
|
|||
_iisContextFactory = new IISContextFactory<TContext>(_memoryPool, application, _options, this, _logger); | |||
_nativeApplication.RegisterCallbacks(_requestHandler, _shutdownHandler, _onDisconnect, _onAsyncCompletion, (IntPtr)_httpServerHandle, (IntPtr)_httpServerHandle); | |||
|
|||
Features.Set<IServerAddressesFeature>(new ServerAddressesFeature(_options.ServerAddresses)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clarification: The IServerAddressesFeature should be created and set in the IServer constructor, but the addresses should not be added until Start.
https://github.com/aspnet/KestrelHttpServer/blob/5c1fcd664d39db8fe5c8e38052a3cc29f90322f6/src/Kestrel.Core/KestrelServer.cs#L50-L51
Yes this is a bit of an arbitrary limitation, but we don't want people to get different behavior in IIS vs selfhost.
src/IISIntegration/src/AspNetCoreModuleV2/CommonLib/BindingInformation.h
Outdated
Show resolved
Hide resolved
|
||
for (auto binding : bindings) | ||
{ | ||
result += binding.QueryProtocol() + L"://" + binding.QueryHost() + L":" + binding.QueryPort() + basePath + L";"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is pathBase encoded or decoded here? e.g. if I have a space in my base path do I get ' ' or %20? The escaped form should be preferred in this url form.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The host is likely in unicode, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a test
src/IISIntegration/src/AspNetCoreModuleV2/RequestHandlerLib/environmentvariablehelpers.h
Outdated
Show resolved
Hide resolved
src/IISIntegration/test/Common.FunctionalTests/Inprocess/FeatureCollectionTests.cs
Outdated
Show resolved
Hide resolved
src/Servers/IIS/src/Microsoft.AspNetCore.Server.IIS/WebHostBuilderIISExtensions.cs
Outdated
Show resolved
Hide resolved
…lderIISExtensions.cs
src/Servers/IIS/src/AspNetCoreModuleV2/CommonLib/BindingInformation.h
Outdated
Show resolved
Hide resolved
src/Servers/IIS/src/AspNetCoreModuleV2/CommonLib/BindingInformation.h
Outdated
Show resolved
Hide resolved
else if (selectedPort != bindingPort) | ||
{ | ||
// If there are multiple endpoints configured return empty port | ||
return L""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
environmentvariablehelpers is checking for null, not empty string. Or is there a difference here?
Fixes: #3843
This feature requires both new shim and new handler to work but is gracefully disabled otherwise.