IISExpressify is a simple wrapper for running IIS Express.
Released under the MIT License. See the LICENSE file for further details.
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>
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.