/// <summary>
        /// Wires up the AspNetCore WCF framework to the given path.
        /// </summary>
        /// <param name="app"></param>
        /// <param name="path"></param>
        /// <param name="options"></param>
        /// <returns></returns>
        public static IApplicationBuilder UseServiceHost(
            this IApplicationBuilder app,
            PathString path,
            AspNetCoreServiceHostOptions options)
        {
            if (app == null)
            {
                throw new ArgumentNullException(nameof(app));
            }
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }
            if (options.ServiceType == null)
            {
                throw new ArgumentException("Must specify ServiceType in options.", nameof(options));
            }

            if (path.HasValue)
            {
                return(app.Map(path, x => x.UseMiddleware <AspNetCoreServiceHostMiddleware>(Options.Create(options))));
            }
            else
            {
                return(app.UseMiddleware <AspNetCoreServiceHostMiddleware>(Options.Create(options)));
            }
        }
Пример #2
0
 /// <summary>
 /// Initializes a new instance.
 /// </summary>
 /// <param name="next"></param>
 /// <param name="router"></param>
 /// <param name="options"></param>
 /// <param name="applicationLifetime"></param>
 /// <param name="serviceProvider"></param>
 public AspNetCoreServiceHostMiddleware(
     RequestDelegate next,
     AspNetCoreRequestRouter router,
     AspNetCoreServiceHostOptions options,
     IApplicationLifetime applicationLifetime,
     ILogger <AspNetCoreServiceHostMiddleware> logger,
     IServiceProvider serviceProvider) :
     this(next, options.ServiceType, CreateBindingFactory(serviceProvider, options.BindingFactoryType), router, options.MessageVersion, applicationLifetime, logger, serviceProvider)
 {
     options.Configure?.Invoke(new AspNetCoreServiceHostConfigurator(this));
 }
        /// <summary>
        /// Wires up the AspNetCore WCF framework to the given path.
        /// </summary>
        /// <param name="app"></param>
        /// <param name="path"></param>
        /// <param name="options"></param>
        /// <returns></returns>
        public static IApplicationBuilder UseServiceHost(
            this IApplicationBuilder app,
            AspNetCoreServiceHostOptions options)
        {
            if (app == null)
            {
                throw new ArgumentNullException(nameof(app));
            }
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }
            if (options.ServiceType == null)
            {
                throw new ArgumentException("Must specify ServiceType in options.", nameof(options));
            }

            return(app.UseServiceHost(PathString.Empty, options));
        }