Commit Graph

796 Commits

Author SHA1 Message Date
David Fowler 5748898fc4
Make the RequestServicesContainerMiddleware thinner (#1360) (#1362)
- Today the request services middleware is responsible for making sure there are request scoped services.
This PR tries introduces some breaking changes that are hopefully acceptable in order to gain some performance.
- Here are the assumptions this PR makes:
 - Since this middleware is first in the pipeline, the only thing that can
  set a default service provider would be the server itself. Since we have no servers that do that
  I removed that code that tries to noop if there's an existing service provider.
 - This PR no longer restores the previous service provider feature since it gets replaced every request
 anyways. Kestrel also clears out the feature on each request so it shouldn't be a problem (in theory).
 Once again, since this middleware is first, it is the last thing that runs before the server re-gains
 control on the way out so there's no need to restore anything.
 - We use the RegisterForDispose method to dispose of the IServiceProvider instead of doing it inline.
2018-03-21 08:58:03 -07:00
Chris Ross (ASP.NET) b6dc00229d Convert TestHost ResponseStream to use Pipes. 2018-03-07 15:22:20 -08:00
Nate McMaster 1f5379e38d
Merge branch 'release/2.1' into dev 2018-03-02 14:11:38 -08:00
Ryan Brandenburg 66714b5fc0 Use ExperimentalPackageVersion 2018-02-15 12:08:50 -08:00
Steve Gordon 8765d55f9f Fixing small typo in a comment (#1328) 2018-02-06 07:57:28 -08:00
BrennanConroy 60cbedf5ee
Don't throw in Nginx deployer dispose (#1327) 2018-02-02 13:44:48 -08:00
David Fowler 6b095cf533
Allow overriding the hosting service provider (#1325)
- Use the IServiceProviderFactory<IServiceCollection>
- Assert creation and disposal service providers
- Updated the tests to verify that service providers are created and disposed
- Called CreateBuilder even in the default case in case the service collection is modified as part of it.
2018-01-31 16:03:40 -08:00
David Fowler f8d61a4c52
Dispose the host if Initialize fails (#1324) 2018-01-31 16:00:55 -08:00
David Fowler cb55973c27
Dispose the host if Initialize fails (#1318) 2018-01-29 02:56:19 -08:00
Ryan Brandenburg 87db08e030 Add missing baselines 2017-12-28 11:46:56 -08:00
Justin Kotalik 9f1e6607dd
Changes OS bitness check to Environment rather than System.Runtime.InteropServices.RuntimeInformation (#1286) 2017-12-05 15:17:15 -08:00
Pranav K 076e5fe6af Fixup name of SystemServiceProcessServiceControllerPackageVersion 2017-11-22 14:52:27 -08:00
John Luo aff78a04af Update property name to match naming scheme 2017-11-20 15:51:17 -08:00
Henk Mollema e03c6a7908 Cross-compile Windows Services hosting package 2017-11-20 15:40:50 -08:00
Justin Kotalik 0b8b099e82
Adds contentRoot to ANCM path (#1272) 2017-11-15 10:32:00 -08:00
Justin Kotalik afb36d9667
Files put in contentFiles are not actually in contentFiles (#1269) 2017-11-14 15:00:26 -08:00
Justin Kotalik f27a5a674e
Updates ANCM path to look in content files (#1268) 2017-11-14 11:39:21 -08:00
Chris Ross (ASP.NET) cd3f58bed7 #1263 Delay IServer and Startup.Configure until StartAsync 2017-11-14 09:19:25 -08:00
Pranav K 311a92ddee React to change in sdk that causes dotnet run to print restore output 2017-11-10 14:57:53 -08:00
Justin Kotalik 3c727be270
Fix path check for ANCM (#1262) 2017-11-10 12:27:51 -08:00
Justin Kotalik 67c028a3cf
React to ANCM dll location changes (#1258) 2017-11-10 11:55:31 -08:00
Justin Kotalik 40bd6e560e
Adds HostingModel as an extra DeploymentParameter (#1261) 2017-11-10 10:07:19 -08:00
David Fowler a78b9c7490
Support the Extensions.Abstractions from Hosting.Abstractions (#1259)
- The goal here is to enable components that use hosting abstractions to use
the web host. It lets us start to decouple components from the web host abstractions
where possible while not breaking any existing components. This will allow things
to work in both the generic host and the web host. The one snafu is the WebHostBuilderContext
which has an IHostingEnvironment typed as the AspNetCore.Abstractions type.
- Updated tests.

#1218
2017-11-09 21:24:30 -08:00
Chris Ross (ASP.NET) 05fd382b93 #1256 Check HasStarted for StatusCode and ReasonPhrase 2017-11-09 13:04:51 -08:00
Chris Ross (ASP.NET) 64596d538b TestServer: Copy the feature collection to mitigate multi-threading 2017-11-09 13:04:51 -08:00
Chris Ross (ASP.NET) 1e556e0b46 #1253 TestServer: mark response headers IsReadOnly on start 2017-11-09 13:04:37 -08:00
John Luo 993cd9f73d Trigger graceful shutdown on stopping webhost service 2017-11-08 11:06:36 -08:00
Chris Ross (ASP.NET) 82ccf4f06e #816 Allow directly constructing an HttpContext for TestServer 2017-11-01 11:07:12 -07:00
Nate McMaster c5f2333481 Pin tool and package versions to make build more repeatable 2017-10-31 13:04:32 -07:00
Javier Calvarro Nelson fc613303ed Add an overload that takes the application base path explicitly 2017-10-31 11:02:48 -07:00
Pavel Krymets e892ed8bbd
Add a way to prevent specific hosting startup from runnning (#1243) 2017-10-27 16:52:39 -07:00
Chris Ross (ASP.NET) 1e360cbb36 #1244 Disable restore on publish for integration tests 2017-10-27 12:20:13 -07:00
Ryan Brandenburg bc4a514d9e Better message for integration tests 2017-10-20 10:49:41 -07:00
Chris Ross (ASP.NET) 4f3fdaebee #1208 Default timeout for IHost.StopAsync. Create Host with DI. 2017-10-17 10:37:20 -07:00
Javier Calvarro Nelson cda9ec6fe4 Remove the implicit hosting dependency on WebHostBuilderFactory shared sources 2017-10-11 15:16:03 -07:00
Justin Kotalik 36bede16e9 Remove check for using ANCM with Win7. (#1235) 2017-10-03 16:43:12 -07:00
John Luo a63932a492 Add option to suppress writing startup messages 2017-10-02 14:08:54 -07:00
Javier Calvarro Nelson 6687f4eefc Update API check baselines to 2.0 2017-09-22 17:52:20 -07:00
KPixel 27a3a89b60 Simplifying ApplicationLifetime.ExecuteHandlers() (#1228) 2017-09-22 06:16:48 -07:00
Chris Ross 253be73b6f Misc generic host pr feedback (#1222) 2017-09-21 15:09:52 -07:00
David Fowler 37e122a0c6 Added overloads without the HostingContext (#1220)
* Added overloads without the HostingContext
2017-09-18 14:48:45 -07:00
David Fowler 712c992ca8 Add BackgroundService, a base class for long running HostedServices (#1215)
* Add BackgroundService, a base class for long running HostedServices
- Today the IHostedService pattern is a StartAsync/StopAsync pattern. Neither of these
methods are supposed to return a long running task that represents an execution. If
you wanted to have some logic run on a timer every 5 minutes, it's unnatural to do so
with simple async idioms. This base class implements IHostedService and exposes
a pattern where a long running async Task can be returned.
- The token passed into ExecuteAsync represents the lifetime of the execution.
- StartAsync and StopAsync were made virtual to allow the derived type to
indicate Start failures.
- Added tests
2017-09-18 12:55:54 -07:00
Justin Kotalik 500668619f Detect duplicate startups in HostingStartupAssemblies (#1183) 2017-09-18 11:47:34 -07:00
Javier Calvarro Nelson c24c717eee Add extension methods in our test host package to streamline setup of apps.
* Create a sources package to encode the convention followed in our templates to create a WebHost.
* Add an extension method to setup the content root relative to the solution folder.
* Add a factory method to create a WebHostBuilder based on the pattern followed in our template.
2017-09-15 15:08:35 -07:00
Julian Dominguez 1c3fa82908 Preserve state in HostBuilder.Properties (#1212) 2017-09-15 02:00:44 -07:00
Chris Ross (ASP.NET) ae9da9290e #1163 Implement the generic host 2017-09-14 14:48:06 -07:00
John Luo 8b30efbe75 Use chained configuration 2017-09-05 12:54:00 -07:00
Nate McMaster 5ca9f8928f Use PackageLineup to manage PackageReference versions 2017-08-29 09:55:55 -07:00
Nate McMaster 9a4a43cc6a Use Directory.Build.props/targets 2017-08-29 09:52:04 -07:00
Eric 9b1cbedffc WebSocketClient.ConnectAsync throws when the provided CancellationToken is cancelled. 2017-08-24 15:14:59 -07:00
John Luo b187c1adc4 Add fallback when resolving application name
- Use the name of the EntryAssembly when application name is not specified
2017-08-24 11:00:01 -07:00
Javier Calvarro Nelson 964b671288 [Fixes #1012] Make it possible to override services when using UseStartup.
* Add IStartupConfigureServicesFilter to wrap ConfigureServices.
* Add IStartupConfigureContainerFilter<TContainerBuilder> to wrap
  ConfigureContainer.
* Make StartupLoader build a thunk for configure services that
  resolves all instances of IStartupConfigureServicesFilter and
  IStartupConfigureContainerFilter<TContainerBuilder> and wraps
  invocations to ConfigureServices and ConfigureContainer respectively.
* Refactor building the ConfigureServices callback into a private
  builder class due to the increased complexity in the process.
2017-08-23 14:32:51 -07:00
Justin Kotalik 1ea0647ae2 Update comments to reflect code behavior (#1182) 2017-08-22 16:46:00 -07:00
Justin Kotalik 312e0da556 Fix case sensitivity on Startup classes and methods (#1166) 2017-08-18 09:45:12 -07:00
Justin Kotalik c74d0e7458 Adds .Value to logger calls to avoid calling .ToUriComponents on a bad header. (#1169)
* Add .Value to request properties in HostingRequestStartLog
2017-08-18 09:43:04 -07:00
Henk Mollema 456957bf57 Use dictionary for deployment parameters (#1126) 2017-08-10 10:56:21 -07:00
Christian Weiss 07f96a444e Always log startup exceptions 2017-08-08 09:55:30 -07:00
John Luo a49db63f06 Increment M.H.Server.IntegrationTesting version 2017-08-07 15:28:45 -07:00
Mike Harder 266736764c Rename to DiagnosticSourceVersion (#1143)
- Matches other repos
2017-07-19 09:37:37 -07:00
David Fowler e4350945c5 Attach the correlation id to the request scope if logging is on (#1138)
- Add the correlation id to the request scope as well as setting
it as the parent id of the activity
2017-07-11 10:03:15 -07:00
Ryan Brandenburg 7ca5002b4c Remove NETSTandard.Library.NETFramework 2017-07-07 10:27:25 -07:00
John Luo 15008b0b7f Add WaitForShutdown to WebHostExtensions 2017-07-01 23:13:52 -07:00
David Fowler b0a70aeef7 Add synchronous Start back to IWebHost (#1125)
* Add synchronous Start back to IWebHost
- Fixed extension methods to have a default(CancellationToken)
- Removed extension methods for Start, StartAsync and StopAsync
2017-07-01 15:00:54 -07:00
David Fowler 5fa9fc9458 Updated breaking changes file 2017-06-23 09:33:58 -07:00
Kristian Hellang 513f6ac816 Avoid having to return anything in StartupBase.ConfigureServices (#957)
* Implement IStartup explicitly so we don't have to return a service provider
* Inherit StartupBase and override CreateServiceProvider
2017-06-23 08:48:06 -07:00
Pranav K acb96ec971 Preapre for StackTrace.Sources changes 2017-06-22 11:18:43 -07:00
Pranav K d14b453c33 Allow publishing rid specific desktop applications 2017-06-21 12:16:01 -07:00
David Fowler e88ad84a72 Create a scoped service provider for the call to Configure (#1106)
* Create a scoped service provider for the call to Configure
- This allows scoped dependencies to be injected into the Configure method.
It means you can resolve the DbContext or any other scoped service without
the hassle of the CreateScope boiler plate. As a side effect, it also makes
Startup.Configure a bit more testable.
2017-06-19 14:14:20 -07:00
David Fowler 70a3017b12 Add overload that takes an IConfigurationBuilder (#1107) 2017-06-19 12:41:43 -07:00
Kiran Challa 21be9922c2 Merge branch 'rel/2.0.0-preview2' into dev-gate 2017-06-15 04:01:23 -07:00
Kiran Challa 53128bca0e Revert "Add "--no-restore" parameter to "dotnet publish" (#1101)"
This reverts commit 007e3b6b51.
2017-06-14 20:06:11 -07:00
Kiran Challa 0b90376bbf Revert "Add "--no-restore" parameter to "dotnet run" (#1104)"
This reverts commit 78877b6ba2.
2017-06-14 20:06:03 -07:00
Kiran Challa 9f49d34c17 Revert "Workaround: On xplat machines, provided executable permission to published standalone application executable"
This reverts commit 51f77ea7f3.
2017-06-14 19:52:54 -07:00
Mike Harder 3763aba85c Merge remote-tracking branch 'origin/rel/2.0.0-preview2' into dev 2017-06-13 10:40:19 -07:00
Mike Harder 78877b6ba2 Add "--no-restore" parameter to "dotnet run" (#1104)
- Workaround for "Publish fails on app with project reference to netstandard2.0 class library" (https://github.com/dotnet/cli/issues/6843)
2017-06-13 10:39:58 -07:00
Mike Harder 86c31c5dc3 Merge remote-tracking branch 'origin/rel/2.0.0-preview2' into dev 2017-06-12 16:59:57 -07:00
Mike Harder 007e3b6b51 Add "--no-restore" parameter to "dotnet publish" (#1101)
- Workaround for "dotnet publish fails on app with project reference to netstandard2.0 class library" (https://github.com/dotnet/cli/issues/6843)
2017-06-12 16:59:34 -07:00
Chris R a2962d54f1 Merge branch 'rel/2.0.0-preview2' into dev 2017-06-02 12:23:47 -07:00
Chris R 5e2bb55be0 Change Certificates.Configuration to a Sources package 2017-06-02 12:21:43 -07:00
Pavel Krymets 0f0c88b8cd React to logging in DI changes (#1089) 2017-06-02 08:33:37 -07:00
Nate McMaster 5bcc76d32c Remove dependency on DataProtection
Reverse changes made in #1064
2017-06-01 16:26:54 -07:00
Chris R 44ccbee9ba Moving CertificateLoader from MetaPackages to Hosting. 2017-05-30 16:26:33 -07:00
Chris R 0177ab8424 Change SelfHostDepoyer to use net461 2017-05-30 09:56:23 -07:00
John Luo 3b488c470a Make IHostedServiceAsync 2017-05-26 10:52:08 -07:00
Nate McMaster 75ba58bac2 Re-add some code that was removed during TFM churn 2017-05-26 09:51:38 -07:00
BrennanConroy 03bdb40f8a Add UseShutdownTimeout Extension (#1086) 2017-05-23 16:20:41 -07:00
Chris R 419ec53d07 React to StringSegment changes 2017-05-23 10:38:21 -07:00
Chris R 7ac6842d18 #1075 Suppress exceptions from failing to load HostingStartup assemblies 2017-05-23 10:36:57 -07:00
John Luo 68d1d4ce12 Remove TestProjectHelpers from Server.IntegrationTesting 2017-05-22 15:55:24 -07:00
BrennanConroy c7bac3133f Chain hosting timeout to StopAsync cancellation token (#1078) 2017-05-19 16:32:45 -07:00
John Luo 62cd07d0a6 Target NETStandard2.0 and add WindowsServices back 2017-05-19 14:17:02 -07:00
John Luo 906af6de30 Update API check exceptions 2017-05-12 11:57:41 -07:00
Hisham Bin Ateya cf23aedb55 Use EnvironmentName instead of magic string (#1065) 2017-05-10 15:20:40 -07:00
Pavel Krymets f8779ee377 Remove unnecessary package references (#1068) 2017-05-10 11:30:40 -07:00
BrennanConroy 9a931554d5 Replace RuntimeEnvironment (#1066) 2017-05-09 14:15:36 -07:00
John Luo 9b80f2a635 Migration 2017-05-05 17:12:36 -07:00
Chris Ross (ASP.NET) 13ea876ca1 Register IApplicationDiscriminator service 2017-05-05 17:07:22 -07:00
John Luo c812e9ae6f Doc comments: Add period at the end of the sentence. 2017-05-03 15:13:00 -07:00
John Luo 781fa1944e Fix ConfigureLogging doc comments 2017-05-03 10:37:45 -07:00
Chris Ross (ASP.NET) d74040786c #1053 Prevent IISExpressDeployer.Dispose nullref if the process failed to start 2017-05-03 09:40:07 -07:00