/iis-expressify

IISExpressify is a simple wrapper for running IIS Express.

Primary LanguageC#MIT LicenseMIT

IISExpressify

NuGet

Description

IISExpressify is a simple wrapper for running IIS Express.

Licensing

Released under the MIT License. See the LICENSE file for further details.

Installation

In the Package Manager Console execute

Install-Package IISExpressify

Or update *.csproj to include a dependency on

<ItemGroup>
  <PackageReference Include="IISExpressify" Version="0.1.0-*" />
</ItemGroup>

Usage

Sample HTTP server running on 8080:

using IISExpressify;
using System.IO;

static async Task Main(string[] args) {
  var path = Environment.CurrentDirectory;
  var file = Path.Combine(path, "test.txt");
  File.WriteAllText(file, "lorem ipsum");

  using (var iisExpress = IISExpress.Http().PhysicalPath(path).Port(8080).Start())
  using (var http = iisExpress.CreateHttpClient()) {
    var contents = await http.GetStringAsync("/test.txt");
    Console.WriteLine(contents);
  }
}

Running this will respond with

> dotnet MyProgram.dll
lorem ipsum

For additional usage see Tests.