diff --git a/src/Nancy.Demo.Hosting.Wcf/MainModule.cs b/src/Nancy.Demo.Hosting.Wcf/MainModule.cs
deleted file mode 100644
index d664159ef2..0000000000
--- a/src/Nancy.Demo.Hosting.Wcf/MainModule.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-namespace Nancy.Demo.Hosting.Wcf
-{
- public class MainModule : NancyModule
- {
- public MainModule()
- {
- Get["/"] = parameters => {
- return View["staticview"];
- };
- }
- }
-}
\ No newline at end of file
diff --git a/src/Nancy.Demo.Hosting.Wcf/Nancy.Demo.Hosting.Wcf.csproj b/src/Nancy.Demo.Hosting.Wcf/Nancy.Demo.Hosting.Wcf.csproj
deleted file mode 100644
index 54eefe4be7..0000000000
--- a/src/Nancy.Demo.Hosting.Wcf/Nancy.Demo.Hosting.Wcf.csproj
+++ /dev/null
@@ -1,162 +0,0 @@
-
-
-
- Debug
- x86
- 8.0.30703
- 2.0
- {EBB6F597-3273-4972-8B25-A809D2FC1F24}
- Exe
- Properties
- Nancy.Demo.Hosting.Wcf
- Nancy.Demo.Hosting.Wcf
- v4.5
- 512
- publish\
- true
- Disk
- false
- Foreground
- 7
- Days
- false
- false
- true
- 0
- 1.0.0.%2a
- false
- false
- true
-
-
-
- x86
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
- AllRules.ruleset
- false
-
-
- x86
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
- AllRules.ruleset
- false
-
-
- Nancy.Demo.Hosting.Wcf.Program
-
-
- true
- bin\x86\MonoDebug\
- DEBUG;TRACE
- full
- x86
- bin\Debug\Nancy.Demo.Hosting.Wcf.exe.CodeAnalysisLog.xml
- true
- GlobalSuppressions.cs
- prompt
- AllRules.ruleset
- ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets
- false
- ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules
- false
- false
- 4
- false
- false
-
-
- bin\x86\MonoRelease\
- TRACE
- true
- pdbonly
- x86
- bin\Release\Nancy.Demo.Hosting.Wcf.exe.CodeAnalysisLog.xml
- true
- GlobalSuppressions.cs
- prompt
- AllRules.ruleset
- ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets
- ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules
- 4
- false
-
-
-
-
-
-
-
-
-
-
-
- C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.ServiceModel.Web.dll
-
-
-
-
- Properties\SharedAssemblyInfo.cs
-
-
-
-
-
-
- {8B7EC9F2-44D2-426C-AE7F-801DC3238259}
- Nancy.Hosting.Wcf
-
-
- {34576216-0DCA-4B0F-A0DC-9075E75A676F}
- Nancy
-
-
-
-
-
-
-
- Always
-
-
-
-
- False
- Microsoft .NET Framework 4 %28x86 and x64%29
- true
-
-
- False
- .NET Framework 3.5 SP1 Client Profile
- false
-
-
- False
- .NET Framework 3.5 SP1
- false
-
-
- False
- Windows Installer 3.1
- true
-
-
-
-
-
\ No newline at end of file
diff --git a/src/Nancy.Demo.Hosting.Wcf/Program.cs b/src/Nancy.Demo.Hosting.Wcf/Program.cs
deleted file mode 100644
index 517df96e25..0000000000
--- a/src/Nancy.Demo.Hosting.Wcf/Program.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-namespace Nancy.Demo.Hosting.Wcf
-{
- using System;
- using System.ServiceModel;
- using System.ServiceModel.Web;
-
- using Nancy.Hosting.Wcf;
-
- class Program
- {
- private static readonly Uri BaseUri = new Uri("http://localhost:1234/Nancy/");
-
- static void Main()
- {
- using (CreateAndOpenWebServiceHost())
- {
- Console.WriteLine("Service is now running on: {0}", BaseUri);
- Console.ReadLine();
- }
- }
-
- private static WebServiceHost CreateAndOpenWebServiceHost()
- {
- var host = new WebServiceHost(
- new NancyWcfGenericService(new DefaultNancyBootstrapper()),
- BaseUri);
-
- host.AddServiceEndpoint(typeof(NancyWcfGenericService), new WebHttpBinding(), "");
- host.Open();
-
- return host;
- }
- }
-}
\ No newline at end of file
diff --git a/src/Nancy.Demo.Hosting.Wcf/README.txt b/src/Nancy.Demo.Hosting.Wcf/README.txt
deleted file mode 100644
index 5f282702bb..0000000000
--- a/src/Nancy.Demo.Hosting.Wcf/README.txt
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/src/Nancy.Demo.Hosting.Wcf/Views/staticview.html b/src/Nancy.Demo.Hosting.Wcf/Views/staticview.html
deleted file mode 100644
index 21a3173649..0000000000
--- a/src/Nancy.Demo.Hosting.Wcf/Views/staticview.html
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
- Nancy - Static view served by WCF host
-
-
- Static view served by WCF host
-
- This view was served by the Nancy WCF host.
-
-
-
\ No newline at end of file
diff --git a/src/Nancy.Demo.Hosting.Wcf/app.config b/src/Nancy.Demo.Hosting.Wcf/app.config
deleted file mode 100644
index d757e6dc64..0000000000
--- a/src/Nancy.Demo.Hosting.Wcf/app.config
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/src/Nancy.Hosting.Wcf.Tests/Nancy.Hosting.Wcf.Tests.csproj b/src/Nancy.Hosting.Wcf.Tests/Nancy.Hosting.Wcf.Tests.csproj
deleted file mode 100644
index fca1242fa0..0000000000
--- a/src/Nancy.Hosting.Wcf.Tests/Nancy.Hosting.Wcf.Tests.csproj
+++ /dev/null
@@ -1,185 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- 8.0.30703
- 2.0
- {3D44A461-3133-4B49-A74B-D25632A12FE5}
- Library
- Properties
- Nancy.Hosting.Wcf.Tests
- Nancy.Hosting.Wcf.Tests
- v4.5
- 512
- publish\
- true
- Disk
- false
- Foreground
- 7
- Days
- false
- false
- true
- 0
- 1.0.0.%2a
- false
- false
- true
-
-
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
- AllRules.ruleset
- false
-
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
- AllRules.ruleset
- false
-
-
- true
- bin\MonoDebug\
- DEBUG;TRACE
- full
- AnyCPU
- bin\Debug\Nancy.Hosting.Wcf.Tests.dll.CodeAnalysisLog.xml
- true
- GlobalSuppressions.cs
- prompt
- AllRules.ruleset
- ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets
- true
- ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules
- true
- 4
- false
- false
-
-
- bin\MonoRelease\
- TRACE
- true
- pdbonly
- AnyCPU
- bin\Release\Nancy.Hosting.Wcf.Tests.dll.CodeAnalysisLog.xml
- true
- GlobalSuppressions.cs
- prompt
- AllRules.ruleset
- ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets
- true
- ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules
- true
- 4
- false
-
-
-
- False
- ..\packages\FakeItEasy.1.19.0\lib\net40\FakeItEasy.dll
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- False
- ..\packages\xunit.1.9.1\lib\net20\xunit.dll
-
-
- False
- ..\packages\xunit.extensions.1.9.1\lib\net20\xunit.extensions.dll
-
-
-
-
- ShouldExtensions.cs
-
-
- SkipException.cs
-
-
- SkippableFactAttribute.cs
-
-
- Properties\SharedAssemblyInfo.cs
-
-
-
-
-
-
- {8B7EC9F2-44D2-426C-AE7F-801DC3238259}
- Nancy.Hosting.Wcf
-
-
- {34576216-0DCA-4B0F-A0DC-9075E75A676F}
- Nancy
-
-
-
-
- False
- Microsoft .NET Framework 4 %28x86 and x64%29
- true
-
-
- False
- .NET Framework 3.5 SP1 Client Profile
- false
-
-
- False
- .NET Framework 3.5 SP1
- false
-
-
- False
- Windows Installer 3.1
- true
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/Nancy.Hosting.Wcf.Tests/NancyWcfGenericServiceFixture.cs b/src/Nancy.Hosting.Wcf.Tests/NancyWcfGenericServiceFixture.cs
deleted file mode 100644
index 0965730b17..0000000000
--- a/src/Nancy.Hosting.Wcf.Tests/NancyWcfGenericServiceFixture.cs
+++ /dev/null
@@ -1,263 +0,0 @@
-namespace Nancy.Hosting.Wcf.Tests
-{
- using System;
- using System.IO;
- using System.Linq;
- using System.Net;
- using System.ServiceModel;
- using System.ServiceModel.Web;
- using System.Threading;
-
- using FakeItEasy;
-
- using Nancy.Bootstrapper;
- using Nancy.Helpers;
- using Nancy.Tests;
- using Nancy.Tests.xUnitExtensions;
-
- using Xunit;
-
- using HttpStatusCode = Nancy.HttpStatusCode;
-
- ///
- /// These tests attempt to listen on port 56297, and so require either administrative
- /// privileges or that a command similar to the following has been run with
- /// administrative privileges:
- /// netsh http add urlacl url=http://+:56297/base user=DOMAIN\user
- /// See http://msdn.microsoft.com/en-us/library/ms733768.aspx for more information.
- ///
- public class NancyWcfGenericServiceFixture
- {
- private static readonly Uri BaseUri = new Uri("http://localhost:56297/base/");
-
- [SkippableFact]
- public void Should_be_able_to_get_any_header_from_selfhost()
- {
- // Given
- using (CreateAndOpenWebServiceHost())
- {
- var request = WebRequest.Create(new Uri(BaseUri, "rel/header/?query=value"));
- request.Method = "GET";
-
- // When
- var header = request.GetResponse().Headers["X-Some-Header"];
-
- // Then
- header.ShouldEqual("Some value");
- }
- }
-
- [SkippableFact]
- public void Should_set_query_string_and_uri_correctly()
- {
- // Given
- Request nancyRequest = null;
- var fakeEngine = A.Fake();
- A.CallTo(() => fakeEngine.HandleRequest(A.Ignored, A>.Ignored, A.Ignored))
- .Invokes(f => nancyRequest = (Request)f.Arguments[0])
- .Returns(TaskHelpers.GetCompletedTask(new NancyContext()));
- var fakeBootstrapper = A.Fake();
- A.CallTo(() => fakeBootstrapper.GetEngine()).Returns(fakeEngine);
-
- // When
- using (CreateAndOpenWebServiceHost(fakeBootstrapper))
- {
- var request = WebRequest.Create(new Uri(BaseUri, "test/stuff?query=value&query2=value2"));
- request.Method = "GET";
-
- try
- {
- request.GetResponse();
- }
- catch (WebException)
- {
- // Will throw because it returns 404 - don't care.
- }
- }
-
- // Then
- nancyRequest.Path.ShouldEqual("/test/stuff");
- Assert.True(nancyRequest.Query.query.HasValue);
- Assert.True(nancyRequest.Query.query2.HasValue);
- }
-
- [SkippableFact]
- public void Should_set_path_and_url_correctly_without_trailing_slash()
- {
- // Given
- Request nancyRequest = null;
- var fakeEngine = A.Fake();
- A.CallTo(() => fakeEngine.HandleRequest(A.Ignored, A>.Ignored, A.Ignored))
- .Invokes(f => nancyRequest = (Request)f.Arguments[0])
- .Returns(TaskHelpers.GetCompletedTask(new NancyContext()));
- var fakeBootstrapper = A.Fake();
- A.CallTo(() => fakeBootstrapper.GetEngine()).Returns(fakeEngine);
-
- var baseUriWithoutTrailingSlash = new Uri("http://localhost:56297/base");
-
- // When
- using(CreateAndOpenWebServiceHost(fakeBootstrapper, baseUriWithoutTrailingSlash))
- {
- var request = WebRequest.Create(new Uri(BaseUri, "test/stuff"));
- request.Method = "GET";
-
- try
- {
- request.GetResponse();
- }
- catch(WebException)
- {
- // Will throw because it returns 404 - don't care.
- }
- }
-
- // Then
- nancyRequest.Path.ShouldEqual("/test/stuff");
- nancyRequest.Url.ToString().ShouldEqual("http://localhost:56297/base/test/stuff");
- }
-
- [SkippableFact]
- public void Should_be_able_to_get_from_selfhost()
- {
- // Given
- using (CreateAndOpenWebServiceHost())
- {
- var reader =
- new StreamReader(WebRequest.Create(new Uri(BaseUri, "rel")).GetResponse().GetResponseStream());
-
- // When
- var response = reader.ReadToEnd();
-
- // Then
- response.ShouldEqual("This is the site route");
- }
- }
-
- [SkippableFact]
- public void Should_be_able_to_post_body_to_selfhost()
- {
- // Given
- using (CreateAndOpenWebServiceHost())
- {
- const string testBody = "This is the body of the request";
-
- var request =
- WebRequest.Create(new Uri(BaseUri, "rel"));
- request.Method = "POST";
-
- var writer =
- new StreamWriter(request.GetRequestStream()) {AutoFlush = true};
- writer.Write(testBody);
-
- // When
- var responseBody =
- new StreamReader(request.GetResponse().GetResponseStream()).ReadToEnd();
-
- // Then
- responseBody.ShouldEqual(testBody);
- }
- }
-
- [SkippableFact]
- public void Should_nancyrequest_contain_hostname_port_and_scheme()
- {
- // Given
- Request nancyRequest = null;
- var fakeEngine = A.Fake();
- var fakeBootstrapper = A.Fake();
-
- A.CallTo(() => fakeEngine.HandleRequest(A.Ignored, A>.Ignored, A.Ignored))
- .Invokes(f => nancyRequest = (Request)f.Arguments[0])
- .Returns(TaskHelpers.GetCompletedTask(new NancyContext()));
- A.CallTo(() => fakeBootstrapper.GetEngine()).Returns(fakeEngine);
-
- // When
- using (CreateAndOpenWebServiceHost(fakeBootstrapper))
- {
- var request = WebRequest.Create(BaseUri);
- request.Method = "GET";
-
- try
- {
- request.GetResponse();
- }
- catch (WebException)
- {
- // Will throw because it returns 404 - don't care.
- }
- }
-
- // Then
- Assert.Equal(56297, nancyRequest.Url.Port);
- Assert.Equal("localhost", nancyRequest.Url.HostName);
- Assert.Equal("http", nancyRequest.Url.Scheme);
- }
-
- [SkippableFact]
- public void Should_not_have_content_type_header_for_not_modified_responses()
- {
- // Given
- var fakeEngine = A.Fake();
- var fakeBootstrapper = A.Fake();
-
- // Context sends back a 304 Not Modified
- var context = new NancyContext
- {
- Response = new Response
- {
- ContentType = null,
- StatusCode = HttpStatusCode.NotModified
- }
- };
-
- A.CallTo(() => fakeEngine.HandleRequest(A.Ignored, A>.Ignored, A.Ignored))
- .Returns(TaskHelpers.GetCompletedTask(context));
- A.CallTo(() => fakeBootstrapper.GetEngine()).Returns(fakeEngine);
-
- // When a request is made and responded to with a status of 304 Not Modified
- WebResponse response = null;
- using (CreateAndOpenWebServiceHost(fakeBootstrapper))
- {
- var request = WebRequest.Create(new Uri(BaseUri, "notmodified"));
- request.Method = "GET";
- try
- {
- request.GetResponse();
- }
- catch (WebException notModifiedEx)
- {
- // Will throw because it returns 304
- response = notModifiedEx.Response;
- }
- }
-
- // Then
- Assert.NotNull(response);
- Assert.False(response.Headers.AllKeys.Any(header => header == "Content-Type"));
- }
-
- private static WebServiceHost CreateAndOpenWebServiceHost(INancyBootstrapper nancyBootstrapper = null, Uri baseUri = null)
- {
- if (nancyBootstrapper == null)
- {
- nancyBootstrapper = new DefaultNancyBootstrapper();
- }
-
- var host = new WebServiceHost(
- new NancyWcfGenericService(nancyBootstrapper),
- baseUri ?? BaseUri);
-
- host.AddServiceEndpoint(typeof (NancyWcfGenericService), new WebHttpBinding(), "");
- try
- {
- host.Open();
- }
- catch (AddressAccessDeniedException)
- {
- throw new SkipException("Skipped due to no Administrator access - please see test fixture for more information.");
- }
-
- return host;
- }
- }
-}
diff --git a/src/Nancy.Hosting.Wcf.Tests/TestModule.cs b/src/Nancy.Hosting.Wcf.Tests/TestModule.cs
deleted file mode 100644
index 8be48dc8ea..0000000000
--- a/src/Nancy.Hosting.Wcf.Tests/TestModule.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-namespace Nancy.Hosting.Wcf.Tests
-{
- using System.IO;
-
- public class TestModule : NancyModule
- {
- public TestModule()
- {
- Get["/notmodified"] = parameters => {
- return HttpStatusCode.NotModified;
- };
-
- Get["/rel"] = parameters => {
- return "This is the site route";
- };
-
- Get["/rel/header"] = parameters =>
- {
- var response = new Response();
- response.Headers["X-Some-Header"] = "Some value";
-
- return response;
- };
-
- Post["/rel"] = parameters => {
- return new StreamReader(this.Request.Body).ReadToEnd();
- };
- }
- }
-}
\ No newline at end of file
diff --git a/src/Nancy.Hosting.Wcf.Tests/packages.config b/src/Nancy.Hosting.Wcf.Tests/packages.config
deleted file mode 100644
index 18f13949c6..0000000000
--- a/src/Nancy.Hosting.Wcf.Tests/packages.config
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/src/Nancy.Hosting.Wcf/FileSystemRootPathProvider.cs b/src/Nancy.Hosting.Wcf/FileSystemRootPathProvider.cs
deleted file mode 100644
index 992daff5f4..0000000000
--- a/src/Nancy.Hosting.Wcf/FileSystemRootPathProvider.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-namespace Nancy.Hosting.Wcf
-{
- using System;
- using System.IO;
- using System.Reflection;
-
- public class FileSystemRootPathProvider : IRootPathProvider
- {
- public string GetRootPath()
- {
- var assembly = Assembly.GetEntryAssembly();
-
- return assembly == null ? Environment.CurrentDirectory : Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
- }
- }
-}
\ No newline at end of file
diff --git a/src/Nancy.Hosting.Wcf/Nancy.Hosting.Wcf.csproj b/src/Nancy.Hosting.Wcf/Nancy.Hosting.Wcf.csproj
deleted file mode 100644
index 75c1a8aec9..0000000000
--- a/src/Nancy.Hosting.Wcf/Nancy.Hosting.Wcf.csproj
+++ /dev/null
@@ -1,160 +0,0 @@
-
-
-
- Debug
- AnyCPU
- 8.0.30703
- 2.0
- {8B7EC9F2-44D2-426C-AE7F-801DC3238259}
- Library
- Properties
- Nancy.Hosting.Wcf
- Nancy.Hosting.Wcf
- v4.5
- 512
- publish\
- true
- Disk
- false
- Foreground
- 7
- Days
- false
- false
- true
- 0
- 1.0.0.%2a
- false
- false
- true
-
-
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
- AllRules.ruleset
- bin\Debug\Nancy.Hosting.Wcf.XML
- false
-
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
- AllRules.ruleset
- bin\Release\Nancy.Hosting.Wcf.XML
- false
-
-
- true
- bin\MonoDebug\
- DEBUG;TRACE
- full
- AnyCPU
- bin\Debug\Nancy.Hosting.Wcf.dll.CodeAnalysisLog.xml
- true
- GlobalSuppressions.cs
- prompt
- AllRules.ruleset
- ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets
- true
- ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules
- true
- 4
- false
- bin\MonoDebug\Nancy.Hosting.Wcf.XML
- false
-
-
- bin\MonoRelease\
- TRACE
- true
- pdbonly
- AnyCPU
- bin\Release\Nancy.Hosting.Wcf.dll.CodeAnalysisLog.xml
- true
- GlobalSuppressions.cs
- prompt
- AllRules.ruleset
- ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets
- true
- ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules
- true
- 4
- bin\MonoRelease\Nancy.Hosting.Wcf.XML
- false
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Properties\SharedAssemblyInfo.cs
-
-
-
-
-
-
- {34576216-0DCA-4B0F-A0DC-9075E75A676F}
- Nancy
-
-
-
-
- False
- Microsoft .NET Framework 4 %28x86 and x64%29
- true
-
-
- False
- .NET Framework 3.5 SP1 Client Profile
- false
-
-
- False
- .NET Framework 3.5 SP1
- false
-
-
- False
- Windows Installer 3.1
- true
-
-
-
-
-
\ No newline at end of file
diff --git a/src/Nancy.Hosting.Wcf/NancyWcfGenericService.cs b/src/Nancy.Hosting.Wcf/NancyWcfGenericService.cs
deleted file mode 100644
index 77b8e57216..0000000000
--- a/src/Nancy.Hosting.Wcf/NancyWcfGenericService.cs
+++ /dev/null
@@ -1,199 +0,0 @@
-namespace Nancy.Hosting.Wcf
-{
- using System;
- using System.Collections.Generic;
- using System.Globalization;
- using System.IdentityModel.Claims;
- using System.IO;
- using System.Linq;
- using System.Net;
- using System.ServiceModel;
- using System.ServiceModel.Channels;
- using System.ServiceModel.Web;
-
- using Nancy.Bootstrapper;
- using Nancy.Extensions;
- using Nancy.IO;
-
- ///
- /// Host for running Nancy ontop of WCF.
- ///
- [ServiceContract]
- [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Multiple)]
- public class NancyWcfGenericService : IDisposable
- {
- private readonly INancyEngine engine;
- private readonly INancyBootstrapper bootstrapper;
-
-
- ///
- /// Initializes a new instance of the class with a default bootstrapper.
- ///
- public NancyWcfGenericService()
- : this(NancyBootstrapperLocator.Bootstrapper)
- {
- }
-
- ///
- /// Initializes a new instance of the class, with the provided .
- ///
- /// An instance, that should be used to handle the requests.
- public NancyWcfGenericService(INancyBootstrapper bootstrapper)
- {
- this.bootstrapper = bootstrapper;
- bootstrapper.Initialise();
- this.engine = bootstrapper.GetEngine();
- }
-
- ///
- /// Handels an incoming request with Nancy.
- ///
- /// The body of the incoming request.
- /// A instance.
- [WebInvoke(UriTemplate = "*", Method = "*")]
- public Message HandleRequests(Stream requestBody)
- {
- var webContext = WebOperationContext.Current;
-
- var nancyRequest =
- CreateNancyRequestFromIncomingWebRequest(webContext.IncomingRequest, requestBody, OperationContext.Current);
-
- var nancyContext =
- engine.HandleRequest(nancyRequest);
-
- SetNancyResponseToOutgoingWebResponse(webContext.OutgoingResponse, nancyContext.Response);
-
- return webContext.CreateStreamResponse(
- stream =>
- {
- nancyContext.Response.Contents(stream);
- nancyContext.Dispose();
- },
- nancyContext.Response.ContentType ?? string.Empty);
- }
-
- public void Dispose()
- {
- this.bootstrapper.Dispose();
- }
-
- private static Request CreateNancyRequestFromIncomingWebRequest(IncomingWebRequestContext webRequest, Stream requestBody, OperationContext context)
- {
- string ip = null;
-
- object remoteEndpointProperty;
- if (OperationContext.Current.IncomingMessageProperties.TryGetValue(RemoteEndpointMessageProperty.Name, out remoteEndpointProperty))
- {
- ip = ((RemoteEndpointMessageProperty)remoteEndpointProperty).Address;
- }
-
- var baseUri =
- GetUrlAndPathComponents(webRequest.UriTemplateMatch.BaseUri);
-
- if(!baseUri.OriginalString.EndsWith("/"))
- {
- baseUri = new Uri(string.Concat(baseUri.OriginalString, "/"));
- }
-
- var relativeUri =
- baseUri.MakeRelativeUri(GetUrlAndPathComponents(webRequest.UriTemplateMatch.RequestUri));
-
- var expectedRequestLength =
- GetExpectedRequestLength(webRequest.Headers.ToDictionary());
-
- var nancyUrl = new Url {
- BasePath = webRequest.UriTemplateMatch.BaseUri.AbsolutePath,
- Scheme = webRequest.UriTemplateMatch.RequestUri.Scheme,
- HostName = webRequest.UriTemplateMatch.BaseUri.Host,
- Port = webRequest.UriTemplateMatch.RequestUri.IsDefaultPort ? null : (int?)webRequest.UriTemplateMatch.RequestUri.Port,
- Path = string.Concat("/", relativeUri),
- Query = webRequest.UriTemplateMatch.RequestUri.Query
- };
-
- byte[] certificate = null;
-
- if (context.ServiceSecurityContext != null && context.ServiceSecurityContext.AuthorizationContext.ClaimSets.Count > 0)
- {
- var claimset =
- context.ServiceSecurityContext.AuthorizationContext.ClaimSets.FirstOrDefault(
- c => c is X509CertificateClaimSet) as X509CertificateClaimSet;
-
- if (claimset != null)
- {
- certificate = claimset.X509Certificate.RawData;
- }
- }
-
- return new Request(
- webRequest.Method,
- nancyUrl,
- RequestStream.FromStream(requestBody, expectedRequestLength, StaticConfiguration.DisableRequestStreamSwitching ?? false),
- webRequest.Headers.ToDictionary(),
- ip,
- certificate);
- }
-
- private static long GetExpectedRequestLength(IDictionary> incomingHeaders)
- {
- if (incomingHeaders == null)
- {
- return 0;
- }
-
- if (!incomingHeaders.ContainsKey("Content-Length"))
- {
- return 0;
- }
-
- var headerValue =
- incomingHeaders["Content-Length"].SingleOrDefault();
-
- if (headerValue == null)
- {
- return 0;
- }
-
- long contentLength;
-
- return !long.TryParse(headerValue, NumberStyles.Any, CultureInfo.InvariantCulture, out contentLength) ?
- 0 :
- contentLength;
- }
-
- private static Uri GetUrlAndPathComponents(Uri uri)
- {
- // ensures that for a given url only the
- // scheme://host:port/paths/somepath
- return new Uri(uri.GetComponents(UriComponents.SchemeAndServer | UriComponents.Path, UriFormat.Unescaped));
- }
-
- private static void SetNancyResponseToOutgoingWebResponse(OutgoingWebResponseContext webResponse, Response nancyResponse)
- {
- SetHttpResponseHeaders(webResponse, nancyResponse);
-
- if (nancyResponse.ContentType != null)
- {
- webResponse.ContentType = nancyResponse.ContentType;
- }
-
- if (nancyResponse.ReasonPhrase != null)
- {
- webResponse.StatusDescription = nancyResponse.ReasonPhrase;
- }
-
- webResponse.StatusCode = (HttpStatusCode)nancyResponse.StatusCode;
- }
-
- private static void SetHttpResponseHeaders(OutgoingWebResponseContext context, Response response)
- {
- foreach (var kvp in response.Headers)
- {
- context.Headers.Add(kvp.Key, kvp.Value);
- }
- foreach (var cookie in response.Cookies)
- {
- context.Headers.Add("Set-Cookie", cookie.ToString());
- }
- }
- }
-}
diff --git a/src/Nancy.Hosting.Wcf/nancy.hosting.wcf.nuspec b/src/Nancy.Hosting.Wcf/nancy.hosting.wcf.nuspec
deleted file mode 100644
index 4552045d43..0000000000
--- a/src/Nancy.Hosting.Wcf/nancy.hosting.wcf.nuspec
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
- Nancy.Hosting.Wcf
- 0.0.0
- Andreas Håkansson, Steven Robbins and contributors
- false
- Enables hosting Nancy on WCF.
- Nancy is a lightweight web framework for the .Net platform, inspired by Sinatra. Nancy aim at delivering a low ceremony approach to building light, fast web applications.
- en-US
- Andreas Håkansson, Steven Robbins and contributors
- http://nancyfx.org/nancy-nuget.png
- https://github.com/NancyFx/Nancy/blob/master/license.txt
- http://nancyfx.org
-
-
-
- Nancy WCF
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/Nancy.sln b/src/Nancy.sln
index 659a68f237..c207c992ff 100644
--- a/src/Nancy.sln
+++ b/src/Nancy.sln
@@ -13,8 +13,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{C83115E9
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nancy", "Nancy\Nancy.csproj", "{34576216-0DCA-4B0F-A0DC-9075E75A676F}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nancy.Hosting.Wcf", "Nancy.Hosting.Wcf\Nancy.Hosting.Wcf.csproj", "{8B7EC9F2-44D2-426C-AE7F-801DC3238259}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nancy.ViewEngines.Razor", "Nancy.ViewEngines.Razor\Nancy.ViewEngines.Razor.csproj", "{2C6F51DF-015C-4DB6-B44C-0E5E4F25E2A9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nancy.ViewEngines.Spark", "Nancy.ViewEngines.Spark\Nancy.ViewEngines.Spark.csproj", "{4B7E35DF-1569-4346-B180-A09615723095}"
@@ -33,8 +31,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nancy.Authentication.Basic"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nancy.Tests", "Nancy.Tests\Nancy.Tests.csproj", "{776D244D-BC4D-4BBB-A478-CAF2D04520E1}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nancy.Hosting.Wcf.Tests", "Nancy.Hosting.Wcf.Tests\Nancy.Hosting.Wcf.Tests.csproj", "{3D44A461-3133-4B49-A74B-D25632A12FE5}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nancy.ViewEngines.Razor.Tests", "Nancy.ViewEngines.Razor.Tests\Nancy.ViewEngines.Razor.Tests.csproj", "{FE32460D-547C-4EB9-A768-541255CCAA83}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nancy.ViewEngines.Spark.Tests", "Nancy.ViewEngines.Spark.Tests\Nancy.ViewEngines.Spark.Tests.csproj", "{06F89662-C2F0-4C1D-8581-E0C4A615B7E2}"
@@ -61,8 +57,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nancy.Demo.Caching", "Nancy
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nancy.Demo.Hosting.Self", "Nancy.Demo.Hosting.Self\Nancy.Demo.Hosting.Self.csproj", "{0B3EA40E-F7D8-4E14-A30F-1536F41B62D1}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nancy.Demo.Hosting.Wcf", "Nancy.Demo.Hosting.Wcf\Nancy.Demo.Hosting.Wcf.csproj", "{EBB6F597-3273-4972-8B25-A809D2FC1F24}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nancy.Demo.Hosting.Aspnet", "Nancy.Demo.Hosting.Aspnet\Nancy.Demo.Hosting.Aspnet.csproj", "{E127FED3-01C0-41BA-BF83-D8DCDD827D6A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nancy.Demo.Authentication.Forms.TestingDemo", "Nancy.Demo.Authentication.Forms.TestingDemo\Nancy.Demo.Authentication.Forms.TestingDemo.csproj", "{948A8EF6-D50C-45EA-9AFD-7A4723ADAB0B}"
@@ -153,16 +147,6 @@ Global
{34576216-0DCA-4B0F-A0DC-9075E75A676F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{34576216-0DCA-4B0F-A0DC-9075E75A676F}.Release|Any CPU.Build.0 = Release|Any CPU
{34576216-0DCA-4B0F-A0DC-9075E75A676F}.Release|x86.ActiveCfg = Release|Any CPU
- {8B7EC9F2-44D2-426C-AE7F-801DC3238259}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {8B7EC9F2-44D2-426C-AE7F-801DC3238259}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {8B7EC9F2-44D2-426C-AE7F-801DC3238259}.Debug|x86.ActiveCfg = Debug|Any CPU
- {8B7EC9F2-44D2-426C-AE7F-801DC3238259}.MonoDebug|Any CPU.ActiveCfg = MonoDebug|Any CPU
- {8B7EC9F2-44D2-426C-AE7F-801DC3238259}.MonoDebug|x86.ActiveCfg = MonoDebug|Any CPU
- {8B7EC9F2-44D2-426C-AE7F-801DC3238259}.MonoRelease|Any CPU.ActiveCfg = MonoRelease|Any CPU
- {8B7EC9F2-44D2-426C-AE7F-801DC3238259}.MonoRelease|x86.ActiveCfg = MonoRelease|Any CPU
- {8B7EC9F2-44D2-426C-AE7F-801DC3238259}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {8B7EC9F2-44D2-426C-AE7F-801DC3238259}.Release|Any CPU.Build.0 = Release|Any CPU
- {8B7EC9F2-44D2-426C-AE7F-801DC3238259}.Release|x86.ActiveCfg = Release|Any CPU
{2C6F51DF-015C-4DB6-B44C-0E5E4F25E2A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2C6F51DF-015C-4DB6-B44C-0E5E4F25E2A9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2C6F51DF-015C-4DB6-B44C-0E5E4F25E2A9}.Debug|x86.ActiveCfg = Debug|Any CPU
@@ -271,16 +255,6 @@ Global
{776D244D-BC4D-4BBB-A478-CAF2D04520E1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{776D244D-BC4D-4BBB-A478-CAF2D04520E1}.Release|Any CPU.Build.0 = Release|Any CPU
{776D244D-BC4D-4BBB-A478-CAF2D04520E1}.Release|x86.ActiveCfg = Release|Any CPU
- {3D44A461-3133-4B49-A74B-D25632A12FE5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {3D44A461-3133-4B49-A74B-D25632A12FE5}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {3D44A461-3133-4B49-A74B-D25632A12FE5}.Debug|x86.ActiveCfg = Debug|Any CPU
- {3D44A461-3133-4B49-A74B-D25632A12FE5}.MonoDebug|Any CPU.ActiveCfg = MonoDebug|Any CPU
- {3D44A461-3133-4B49-A74B-D25632A12FE5}.MonoDebug|x86.ActiveCfg = MonoDebug|Any CPU
- {3D44A461-3133-4B49-A74B-D25632A12FE5}.MonoRelease|Any CPU.ActiveCfg = MonoRelease|Any CPU
- {3D44A461-3133-4B49-A74B-D25632A12FE5}.MonoRelease|x86.ActiveCfg = MonoRelease|Any CPU
- {3D44A461-3133-4B49-A74B-D25632A12FE5}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {3D44A461-3133-4B49-A74B-D25632A12FE5}.Release|Any CPU.Build.0 = Release|Any CPU
- {3D44A461-3133-4B49-A74B-D25632A12FE5}.Release|x86.ActiveCfg = Release|Any CPU
{FE32460D-547C-4EB9-A768-541255CCAA83}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FE32460D-547C-4EB9-A768-541255CCAA83}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FE32460D-547C-4EB9-A768-541255CCAA83}.Debug|x86.ActiveCfg = Debug|Any CPU
@@ -439,20 +413,6 @@ Global
{0B3EA40E-F7D8-4E14-A30F-1536F41B62D1}.Release|Any CPU.Build.0 = Release|x86
{0B3EA40E-F7D8-4E14-A30F-1536F41B62D1}.Release|x86.ActiveCfg = Release|x86
{0B3EA40E-F7D8-4E14-A30F-1536F41B62D1}.Release|x86.Build.0 = Release|x86
- {EBB6F597-3273-4972-8B25-A809D2FC1F24}.Debug|Any CPU.ActiveCfg = Debug|x86
- {EBB6F597-3273-4972-8B25-A809D2FC1F24}.Debug|Any CPU.Build.0 = Debug|x86
- {EBB6F597-3273-4972-8B25-A809D2FC1F24}.Debug|x86.ActiveCfg = Debug|x86
- {EBB6F597-3273-4972-8B25-A809D2FC1F24}.Debug|x86.Build.0 = Debug|x86
- {EBB6F597-3273-4972-8B25-A809D2FC1F24}.MonoDebug|Any CPU.ActiveCfg = MonoDebug|x86
- {EBB6F597-3273-4972-8B25-A809D2FC1F24}.MonoDebug|x86.ActiveCfg = MonoDebug|x86
- {EBB6F597-3273-4972-8B25-A809D2FC1F24}.MonoDebug|x86.Build.0 = MonoDebug|x86
- {EBB6F597-3273-4972-8B25-A809D2FC1F24}.MonoRelease|Any CPU.ActiveCfg = MonoRelease|x86
- {EBB6F597-3273-4972-8B25-A809D2FC1F24}.MonoRelease|x86.ActiveCfg = MonoRelease|x86
- {EBB6F597-3273-4972-8B25-A809D2FC1F24}.MonoRelease|x86.Build.0 = MonoRelease|x86
- {EBB6F597-3273-4972-8B25-A809D2FC1F24}.Release|Any CPU.ActiveCfg = Release|x86
- {EBB6F597-3273-4972-8B25-A809D2FC1F24}.Release|Any CPU.Build.0 = Release|x86
- {EBB6F597-3273-4972-8B25-A809D2FC1F24}.Release|x86.ActiveCfg = Release|x86
- {EBB6F597-3273-4972-8B25-A809D2FC1F24}.Release|x86.Build.0 = Release|x86
{E127FED3-01C0-41BA-BF83-D8DCDD827D6A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E127FED3-01C0-41BA-BF83-D8DCDD827D6A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E127FED3-01C0-41BA-BF83-D8DCDD827D6A}.Debug|x86.ActiveCfg = Debug|Any CPU
@@ -855,7 +815,6 @@ Global
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{34576216-0DCA-4B0F-A0DC-9075E75A676F} = {E944109B-0B7A-4ADE-8602-004CEFA5897D}
- {8B7EC9F2-44D2-426C-AE7F-801DC3238259} = {E944109B-0B7A-4ADE-8602-004CEFA5897D}
{2C6F51DF-015C-4DB6-B44C-0E5E4F25E2A9} = {E944109B-0B7A-4ADE-8602-004CEFA5897D}
{4B7E35DF-1569-4346-B180-A09615723095} = {E944109B-0B7A-4ADE-8602-004CEFA5897D}
{15B7F794-0BB2-4B66-AD78-4A951F1209B2} = {E944109B-0B7A-4ADE-8602-004CEFA5897D}
@@ -865,7 +824,6 @@ Global
{B795886D-9D70-45B1-BFB5-AD54CBC9A447} = {E944109B-0B7A-4ADE-8602-004CEFA5897D}
{BD72B98D-C81A-4013-B606-94B4BA2273E5} = {E944109B-0B7A-4ADE-8602-004CEFA5897D}
{776D244D-BC4D-4BBB-A478-CAF2D04520E1} = {A427F9F8-0A6F-4EEA-837F-FCDAB6E7D4B3}
- {3D44A461-3133-4B49-A74B-D25632A12FE5} = {A427F9F8-0A6F-4EEA-837F-FCDAB6E7D4B3}
{FE32460D-547C-4EB9-A768-541255CCAA83} = {A427F9F8-0A6F-4EEA-837F-FCDAB6E7D4B3}
{06F89662-C2F0-4C1D-8581-E0C4A615B7E2} = {A427F9F8-0A6F-4EEA-837F-FCDAB6E7D4B3}
{D0F1D7F4-0D48-49AE-9E33-005926B58B1D} = {A427F9F8-0A6F-4EEA-837F-FCDAB6E7D4B3}
@@ -879,7 +837,6 @@ Global
{EF660223-4DFD-4E36-BF36-9DD6AFB3F837} = {4A24657F-9695-437B-9702-2541ED280628}
{28F9EA8B-90F7-4974-BB40-0B7FA9309D02} = {4A24657F-9695-437B-9702-2541ED280628}
{0B3EA40E-F7D8-4E14-A30F-1536F41B62D1} = {4A24657F-9695-437B-9702-2541ED280628}
- {EBB6F597-3273-4972-8B25-A809D2FC1F24} = {4A24657F-9695-437B-9702-2541ED280628}
{E127FED3-01C0-41BA-BF83-D8DCDD827D6A} = {4A24657F-9695-437B-9702-2541ED280628}
{948A8EF6-D50C-45EA-9AFD-7A4723ADAB0B} = {4A24657F-9695-437B-9702-2541ED280628}
{1258BFCD-3BAD-4373-B786-4D698EC3C157} = {4A24657F-9695-437B-9702-2541ED280628}