OkOwin.IIS 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package OkOwin.IIS --version 1.0.1                
NuGet\Install-Package OkOwin.IIS -Version 1.0.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="OkOwin.IIS" Version="1.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add OkOwin.IIS --version 1.0.1                
#r "nuget: OkOwin.IIS, 1.0.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install OkOwin.IIS as a Cake Addin
#addin nuget:?package=OkOwin.IIS&version=1.0.1

// Install OkOwin.IIS as a Cake Tool
#tool nuget:?package=OkOwin.IIS&version=1.0.1                
using Microsoft.Owin;
using Microsoft.Owin.Cors;
using Microsoft.Owin.FileSystems;
using Microsoft.Owin.StaticFiles;
using Owin;
using System.Web.Http;

namespace TestOwinIISWebApi
{
    public class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            app.UseCors(CorsOptions.AllowAll);

            #region Cors Domain

            //var policy = new CorsPolicy()
            //{
            //    AllowAnyHeader = true,
            //    AllowAnyMethod = true,
            //    SupportsCredentials = true
            //};

            //// list of domains that are allowed can be added here
            //policy.Origins.Add("domain");
            ////be sure to include the port:
            ////example: "http://localhost:8081"

            //app.UseCors(new CorsOptions
            //{
            //    PolicyProvider = new CorsPolicyProvider
            //    {
            //        PolicyResolver = context => Task.FromResult(policy)
            //    }
            //});

            #endregion

            app.MapWhen(context =>
            {
                return context.Request.Path.Value.StartsWith("/people");

            }, builder =>
            {
                builder.Run(async (context) =>
                {
                    await context.Response.WriteAsync("people");

                });
            });

            app.Map("/a/index", builder =>
            {
                builder.Run(async (context) =>
                {
                    await context.Response.WriteAsync("aaaaa");

                });
            });

            app.Map("/b/index", builder =>
            {
                builder.Run(async (context) =>
                {
                    await context.Response.WriteAsync("bbbb");

                });
            });

            //WebApi
            var config = GetWebApiConfig();
            app.UseWebApi(config);

            //wwwroot
            var fileOptions = new FileServerOptions()
            {
                RequestPath = PathString.Empty,
                EnableDefaultFiles = true,
                EnableDirectoryBrowsing = false,
                FileSystem = new PhysicalFileSystem(@".\wwwroot"),
            };
            fileOptions.StaticFileOptions.ServeUnknownFileTypes = true;
            app.UseFileServer(fileOptions);

        }

        private HttpConfiguration GetWebApiConfig()
        {
            HttpConfiguration config = new HttpConfiguration();

            config.MapHttpAttributeRoutes();

            config.Routes.MapHttpRoute(
            name: "Default",
            routeTemplate: "api/{controller}/{action}",
            defaults: new { id = RouteParameter.Optional }
            );

            //config.Formatters.JsonFormatter.MediaTypeMappings.Add(new QueryStringMapping("datatype", "json", "application/json"));

            config.Formatters.Remove(config.Formatters.XmlFormatter);

            config.Formatters.JsonFormatter.SerializerSettings = new Newtonsoft.Json.JsonSerializerSettings()
            {
                NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore
            };

            return config;
        }

    }
}

<?xml version="1.0" encoding="utf-8"?>
<configuration>
	<system.web>
		<compilation debug="true" targetFramework="4.5.2" />
		<httpRuntime targetFramework="4.5.2" />
	</system.web>
	<system.webServer>
		<modules runAllManagedModulesForAllRequests="true">
			<remove name="FormsAuthentication" />
		</modules>
		<handlers>
			<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
			<remove name="OPTIONSVerbHandler" />
			<remove name="TRACEVerbHandler" />
			<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
			<add name="Owin" verb="" path="*" type="Microsoft.Owin.Host.SystemWeb.OwinHttpHandler, Microsoft.Owin.Host.SystemWeb"/>
		</handlers>
	</system.webServer>
	<runtime>
		<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
			<dependentAssembly>
				<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
				<bindingRedirect oldVersion="0.0.0.0-4.2.2.0" newVersion="4.2.2.0" />
			</dependentAssembly>
		</assemblyBinding>
		<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
			<dependentAssembly>
				<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
				<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
			</dependentAssembly>
		</assemblyBinding>
	</runtime>
</configuration>
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.2 311 11/23/2023
1.0.1 206 4/11/2023