close
Skip to content

Add IServerAddressesFeature support#4685

Merged
pakrym merged 15 commits into
masterfrom
pakrym/iis-bindings
Dec 20, 2018
Merged

Add IServerAddressesFeature support#4685
pakrym merged 15 commits into
masterfrom
pakrym/iis-bindings

Conversation

@pakrym
Copy link
Copy Markdown
Contributor

@pakrym pakrym commented Dec 13, 2018

Fixes: #3843

This feature requires both new shim and new handler to work but is gracefully disabled otherwise.

@pakrym pakrym requested review from Tratcher and jkotalik December 13, 2018 00:55
@Tratcher
Copy link
Copy Markdown
Member

Multiple IIS test failures?

@pakrym
Copy link
Copy Markdown
Contributor Author

pakrym commented Dec 13, 2018

Yep, I missed something. But in general PR ready for review.

Comment thread src/IISIntegration/src/AspNetCoreModuleV2/CommonLib/BindingInformation.h Outdated
Comment thread src/IISIntegration/src/AspNetCoreModuleV2/CommonLib/BindingInformation.h Outdated
Comment thread src/IISIntegration/test/WebSites/OutOfProcessWebSite/Startup.cs Outdated
@pakrym
Copy link
Copy Markdown
Contributor Author

pakrym commented Dec 14, 2018

Failures are AuthSamples tests

_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));
Copy link
Copy Markdown
Member

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.


for (auto binding : bindings)
{
result += binding.QueryProtocol() + L"://" + binding.QueryHost() + L":" + binding.QueryPort() + basePath + L";";
Copy link
Copy Markdown
Member

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.

Copy link
Copy Markdown
Member

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a test

Comment thread src/Servers/IIS/src/AspNetCoreModuleV2/CommonLib/BindingInformation.h Outdated
Comment thread src/Servers/IIS/src/AspNetCoreModuleV2/CommonLib/BindingInformation.h Outdated
else if (selectedPort != bindingPort)
{
// If there are multiple endpoints configured return empty port
return L"";
Copy link
Copy Markdown
Member

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?

Comment thread src/Servers/IIS/src/Microsoft.AspNetCore.Server.IIS/Core/IISHttpServer.cs Outdated
Comment thread src/Servers/IIS/src/Microsoft.AspNetCore.Server.IISIntegration/IISSetupFilter.cs Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants