Skip to content

Commit 1494307

Browse files
committed
Added support for running Suave as IIS Site
1 parent f9b1825 commit 1494307

File tree

14 files changed

+237
-15
lines changed

14 files changed

+237
-15
lines changed

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,30 @@ Now create new web application on IIS:
7575

7676
Copy all your build files into `C:\inetpub\wwwroot\myiiswebnamemyiiswebname` and navigate to `http://localhost/myiiswebname`. You should see your web application output now.
7777

78+
## IIS Site
79+
80+
If you need to run Suave application as Site (on default port 80 or any other port), just **omit second parameter** in arguments attribute of httpPlatformHandler section in `web.config` file:
81+
82+
```xml
83+
<?xml version="1.0" encoding="UTF-8"?>
84+
<configuration>
85+
<system.webServer>
86+
<handlers>
87+
<remove name="httpplatformhandler" />
88+
<add name="httpplatformhandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/>
89+
</handlers>
90+
<httpPlatform
91+
forwardWindowsAuthToken="true"
92+
stdoutLogEnabled="true"
93+
stdoutLogFile="myiiswebname.log"
94+
startupTimeLimit="20"
95+
processPath="C:\inetpub\wwwroot\myiiswebname\myiiswebname.exe"
96+
arguments="%HTTP_PLATFORM_PORT%"/>
97+
<!-- now running on http://localhost/ -->
98+
</system.webServer>
99+
</configuration>
100+
```
101+
78102
## Good to know
79103

80104
1. Maybe you didn\`t notice, but using this library, you can still run Suave localy (from Visual Studio hitting F5 or FAKE script) - it there are no command line arguments, default setup is used, so you don\`t need to change anything. Just use `withPort` and create custom filter functions based on `Suave.IIS.Configuration`.

RELEASE_NOTES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
#### 2.1.0 - February 15 2017
2+
* Added support for running Suave as IIS Site
3+
* Configuration Setup path is now optional
4+
15
#### 2.0.0 - January 12 2017
26
* Added support for Suave 2.0
37
* Support for lower Suave version dropped because of breaking changes in API

Suave.IIS.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{8765C23F
1313
nuget\Suave.IIS.nuspec = nuget\Suave.IIS.nuspec
1414
EndProjectSection
1515
EndProject
16+
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Suave.IIS.TestApp", "tests\Suave.IIS.TestApp\Suave.IIS.TestApp.fsproj", "{CED2BCC6-7B7F-41FA-9756-7369E4EFFF50}"
17+
EndProject
1618
Global
1719
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1820
Debug|Any CPU = Debug|Any CPU
@@ -23,6 +25,10 @@ Global
2325
{0A7B66EC-C871-47AA-9684-3372EF7954F7}.Debug|Any CPU.Build.0 = Debug|Any CPU
2426
{0A7B66EC-C871-47AA-9684-3372EF7954F7}.Release|Any CPU.ActiveCfg = Release|Any CPU
2527
{0A7B66EC-C871-47AA-9684-3372EF7954F7}.Release|Any CPU.Build.0 = Release|Any CPU
28+
{CED2BCC6-7B7F-41FA-9756-7369E4EFFF50}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
29+
{CED2BCC6-7B7F-41FA-9756-7369E4EFFF50}.Debug|Any CPU.Build.0 = Debug|Any CPU
30+
{CED2BCC6-7B7F-41FA-9756-7369E4EFFF50}.Release|Any CPU.ActiveCfg = Release|Any CPU
31+
{CED2BCC6-7B7F-41FA-9756-7369E4EFFF50}.Release|Any CPU.Build.0 = Release|Any CPU
2632
EndGlobalSection
2733
GlobalSection(SolutionProperties) = preSolution
2834
HideSolutionNode = FALSE

nuget/Suave.IIS.nuspec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
<version>@build.number@</version>
77
<authors>Roman Provaznik</authors>
88
<owners>Roman Provaznik</owners>
9-
<licenseUrl>http://github.com/dzoukr/Suave.IIS/blob/master/LICENSE</licenseUrl>
10-
<projectUrl>http://github.com/dzoukr/Suave.IIS</projectUrl>
11-
<iconUrl>https://avatars2.githubusercontent.com/u/851307?v=3&amp;s=64</iconUrl>
9+
<licenseUrl>https://github.com/SuaveIO/suave/blob/master/COPYING</licenseUrl>
10+
<projectUrl>https://github.com/SuaveIO/Suave.IIS</projectUrl>
11+
<iconUrl>https://raw.githubusercontent.com/SuaveIO/resources/master/images/head_trans.png</iconUrl>
1212
<requireLicenseAcceptance>false</requireLicenseAcceptance>
1313
<summary>Set of helper functions for smooth running Suave web server on Internet Information Services (IIS)</summary>
1414
<description>@description@</description>

paket.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ NUGET
99
NuGet.CommandLine (3.4.3)
1010
NUnit (3.5)
1111
NUnit.ConsoleRunner (3.5)
12-
Suave (2.0)
12+
Suave (2.0.3)
1313
FSharp.Core (>= 4.0.0.1)

src/Suave.IIS/AssemblyInfo.fs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ open System.Reflection
55
[<assembly: AssemblyTitleAttribute("Suave.IIS")>]
66
[<assembly: AssemblyProductAttribute("Suave.IIS")>]
77
[<assembly: AssemblyDescriptionAttribute("Set of helper functions for smooth running Suave web server on Internet Information Services (IIS)")>]
8-
[<assembly: AssemblyVersionAttribute("2.0.0")>]
9-
[<assembly: AssemblyFileVersionAttribute("2.0.0")>]
8+
[<assembly: AssemblyVersionAttribute("2.1.0")>]
9+
[<assembly: AssemblyFileVersionAttribute("2.1.0")>]
1010
do ()
1111

1212
module internal AssemblyVersionInformation =
1313
let [<Literal>] AssemblyTitle = "Suave.IIS"
1414
let [<Literal>] AssemblyProduct = "Suave.IIS"
1515
let [<Literal>] AssemblyDescription = "Set of helper functions for smooth running Suave web server on Internet Information Services (IIS)"
16-
let [<Literal>] AssemblyVersion = "2.0.0"
17-
let [<Literal>] AssemblyFileVersion = "2.0.0"
16+
let [<Literal>] AssemblyVersion = "2.1.0"
17+
let [<Literal>] AssemblyFileVersion = "2.1.0"

src/Suave.IIS/Configuration.fs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ open System.Net
55

66
type Setup = {
77
Port: uint16
8-
Path: string
8+
Path: string option
99
}
1010

1111
/// Parse configuration setup from command line args
1212
let parseSetup (args:string []) =
1313
match args |> Array.length with
14-
| x when x >= 2 -> { Port = uint16 args.[0]; Path = args.[1] } |> Some
14+
| x when x = 2 -> { Port = uint16 args.[0]; Path = Some args.[1] } |> Some
15+
| x when x = 1 -> { Port = uint16 args.[0]; Path = None } |> Some
1516
| _ -> None
1617

1718
/// Set Suave port based on command line args setup

src/Suave.IIS/Filters.fs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
/// IIS wrapper for Suave.Filters.path function
44
let path (args:string []) p =
55
match args |> Configuration.parseSetup with
6-
| Some(setup) -> Suave.Filters.path <| sprintf "/%s%s" setup.Path p
7-
| None -> Suave.Filters.path p
6+
| Some({Path = Some setupPath}) -> Suave.Filters.path <| sprintf "/%s%s" setupPath p
7+
| _ -> Suave.Filters.path p
88

99
/// IIS wrapper for Suave.Filters.pathScan function
1010
let pathScan (args:string []) (pf:PrintfFormat<'a,'b,'c,'d,'t>)=
1111
match args |> Configuration.parseSetup with
12-
| Some(setup) ->
13-
let newValue = "/" + setup.Path + pf.Value
12+
| Some({Path = Some setupPath}) ->
13+
let newValue = "/" + setupPath + pf.Value
1414
Suave.Filters.pathScan (PrintfFormat<'a,'b,'c,'d,'t>(newValue))
15-
| None -> Suave.Filters.pathScan pf
15+
| _ -> Suave.Filters.pathScan pf

tests/Suave.IIS.TestApp/App.config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
5+
</startup>
6+
</configuration>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
namespace Suave.IIS.TestApp.AssemblyInfo
2+
3+
open System.Reflection
4+
open System.Runtime.CompilerServices
5+
open System.Runtime.InteropServices
6+
7+
// General Information about an assembly is controlled through the following
8+
// set of attributes. Change these attribute values to modify the information
9+
// associated with an assembly.
10+
[<assembly: AssemblyTitle("Suave.IIS.TestApp")>]
11+
[<assembly: AssemblyDescription("")>]
12+
[<assembly: AssemblyConfiguration("")>]
13+
[<assembly: AssemblyCompany("")>]
14+
[<assembly: AssemblyProduct("Suave.IIS.TestApp")>]
15+
[<assembly: AssemblyCopyright("Copyright © 2017")>]
16+
[<assembly: AssemblyTrademark("")>]
17+
[<assembly: AssemblyCulture("")>]
18+
19+
// Setting ComVisible to false makes the types in this assembly not visible
20+
// to COM components. If you need to access a type in this assembly from
21+
// COM, set the ComVisible attribute to true on that type.
22+
[<assembly: ComVisible(false)>]
23+
24+
// The following GUID is for the ID of the typelib if this project is exposed to COM
25+
[<assembly: Guid("ced2bcc6-7b7f-41fa-9756-7369e4efff50")>]
26+
27+
// Version information for an assembly consists of the following four values:
28+
//
29+
// Major Version
30+
// Minor Version
31+
// Build Number
32+
// Revision
33+
//
34+
// You can specify all the values or you can default the Build and Revision Numbers
35+
// by using the '*' as shown below:
36+
// [<assembly: AssemblyVersion("1.0.*")>]
37+
[<assembly: AssemblyVersion("1.0.0.0")>]
38+
[<assembly: AssemblyFileVersion("1.0.0.0")>]
39+
40+
do
41+
()

0 commit comments

Comments
 (0)