{"id":17008714,"url":"https://github.com/i-e-b/huygens","last_synced_at":"2025-10-09T18:30:34.869Z","repository":{"id":139825252,"uuid":"135755979","full_name":"i-e-b/Huygens","owner":"i-e-b","description":"Cut down Cassini server for internally hosting IIS sites","archived":false,"fork":false,"pushed_at":"2019-05-29T12:44:37.000Z","size":85,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-09-14T09:38:27.850Z","etag":null,"topics":["azure","http-proxy","http-server","iis","integration-testing","working"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/i-e-b.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-06-01T19:30:03.000Z","updated_at":"2023-08-30T12:41:07.000Z","dependencies_parsed_at":"2023-06-09T00:45:33.361Z","dependency_job_id":null,"html_url":"https://github.com/i-e-b/Huygens","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/i-e-b/Huygens","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/i-e-b%2FHuygens","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/i-e-b%2FHuygens/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/i-e-b%2FHuygens/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/i-e-b%2FHuygens/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/i-e-b","download_url":"https://codeload.github.com/i-e-b/Huygens/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/i-e-b%2FHuygens/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001947,"owners_count":26083226,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["azure","http-proxy","http-server","iis","integration-testing","working"],"created_at":"2024-10-14T05:29:05.034Z","updated_at":"2025-10-09T18:30:34.246Z","avatar_url":"https://github.com/i-e-b.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n**NOTE** Huygen does not support running sites hosted with `Microsoft.Owin`\n \n# Huygens\nCut down CassiniDev server for internally hosting IIS sites\n\nhttps://www.nuget.org/packages/Huygens\nhttps://github.com/i-e-b/Huygens\n\nDerived from https://archive.codeplex.com/?p=cassinidev and released under the same license.\n\nLibrary to load, host and run ASP.Net websites inside your own process.\nHas functionality equivalent to the IIS Developer server.\nCan expose IP ports or keep sites internal to your process.\nSupports .Net MVC and Web APIs\n\nThe library contains a set of interfaces and wrappers under the `Huygens.Compatibility` namespace, to help\nconvert between the many different HTTP request and response types in the .Net ecosystem.\n\n**NOTE** Huygen does not support running sites hosted with `Microsoft.Owin`\n\nTo do:\n\n* [ ] Decode HTTP chunked responses?\n* [ ] Add OWIN rq/tx to the compatibility classes\n* [ ] Allow DirectCall to use IRequest/IResponse or IContext\n\n## Internal hosting\n\nYou can host a site without exposing on an IP port like this:\n\n```csharp\nusing (var server = new DirectServer(@\"C:\\inetpub\\wwwroot\\PublishSample\")) // a published site\n{\n    var request = new SerialisableRequest{\n        Method = \"GET\",\n        RequestUri = \"/values\",\n        Headers = new Dictionary˂string, string˃{\n            { \"Content-Type\",\"application/json\" }\n        },\n        Content = null\n    };\n\n    var result = server.DirectCall(request);\n\n    var resultString = Encoding.UTF8.GetString(result.Content);\n    Console.WriteLine(resultString);\n}\n```\n\nCreating a new `DirectServer` takes a few seconds, but it can handle an unlimited number of `DirectCall` requests.\nMore than one site can be hosted in a parent process.\n\n## External hosting\n\nYou can expose the site to a port like this:\n\n```csharp\nusing (var server = new SocketServer(32768, \"/\", @\"C:\\inetpub\\wwwroot\\PublishSample\"))\n{\n    server.Start();\n\n    // accessible to web browsers etc.\n\n    server.ShutDown();\n}\n```\n\nCreating a new `SocketServer` takes a few seconds, but it can handle an unlimited number of calls.\nNote that if you want to host more than one `SocketServer` in your process, each must have its own IP address.\n\n## Self-hosting\n\nHuygens can be used as a small socket server for testing and selfhosting (much as .Net's `HttpListener`).\n\n```csharp\nvar host = new TestHost();\nusing (var subject = new SocketSelfHostServer(8082, host)) {\n    subject.Start();\n    while (true) { Thread.Sleep(2000); }\n}\n\npublic class TestHost : IHost {\n    public void ProcessRequest(IConnection conn)\n    {\n        conn.WriteEntireResponseFromString(200, null, \"Hello, world\", false);\n    }\n// . . .\n}\n```\n\n## Azure hosting\n\nYou can't use the `SocketServer` on Azure, due to permissions limitations. The `DirectServer` is usable as long as you have a **B1** or higher application service plan, and your host app has the *Application Setting* `WEBSITE_LOAD_USER_PROFILE` = `1`\nYou can also host the DirectServer in a 'Web Job', 'Worker Role' or 'Service Fabric' resource.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fi-e-b%2Fhuygens","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fi-e-b%2Fhuygens","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fi-e-b%2Fhuygens/lists"}