Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add a 'serviceUrlBaseValue' appsetting. Works the same as urlBaseValu…

…e, for service sites.
  • Loading branch information...
commit 1c8f37137a693db048f74599ced56cbae474f3ba 1 parent 7951b2f
@remcoros remcoros authored
View
17 Kudu.SiteManagement/DefaultSettingsResolver.cs
@@ -6,13 +6,14 @@ namespace Kudu.SiteManagement
public class DefaultSettingsResolver : ISettingsResolver
{
private readonly string _sitesBaseUrl;
+ private readonly string _serviceSitesBaseUrl;
public DefaultSettingsResolver()
- : this(sitesBaseUrl: null)
+ : this(sitesBaseUrl: null, serviceSitesBaseUrl: null)
{
}
- public DefaultSettingsResolver(string sitesBaseUrl)
+ public DefaultSettingsResolver(string sitesBaseUrl, string serviceSitesBaseUrl)
{
// Ensure the base url is normalised to not have a leading dot,
// we will add this on later when joining the application name up
@@ -20,6 +21,10 @@ public DefaultSettingsResolver(string sitesBaseUrl)
{
_sitesBaseUrl = sitesBaseUrl.TrimStart('.');
}
+ if (serviceSitesBaseUrl != null)
+ {
+ _serviceSitesBaseUrl = serviceSitesBaseUrl.TrimStart('.');
+ }
}
public string SitesBaseUrl
@@ -29,5 +34,13 @@ public string SitesBaseUrl
return _sitesBaseUrl;
}
}
+
+ public string ServiceSitesBaseUrl
+ {
+ get
+ {
+ return _serviceSitesBaseUrl;
+ }
+ }
}
}
View
2  Kudu.SiteManagement/ISettingsResolver.cs
@@ -3,5 +3,7 @@
public interface ISettingsResolver
{
string SitesBaseUrl { get; }
+
+ string ServiceSitesBaseUrl { get; }
}
}
View
13 Kudu.SiteManagement/SiteManager.cs
@@ -110,10 +110,11 @@ public Site CreateSite(string applicationName)
{
// Determine the host header values
List<string> siteBindings = GetDefaultBindings(applicationName);
+ List<string> serviceSiteBindings = GetDefaultServiceBindings(applicationName);
// Create the service site for this site
string serviceSiteName = GetServiceSite(applicationName);
- var serviceSite = CreateSite(iis, applicationName, serviceSiteName, _pathResolver.ServiceSitePath, siteBindings, true);
+ var serviceSite = CreateSite(iis, applicationName, serviceSiteName, _pathResolver.ServiceSitePath, serviceSiteBindings, true);
IIS.Binding serviceSiteBinding = EnsureBinding(serviceSite.Bindings);
int serviceSitePort = serviceSiteBinding.EndPoint.Port;
@@ -303,6 +304,16 @@ private List<String> GetDefaultBindings(string applicationName)
return siteBindings;
}
+ private List<String> GetDefaultServiceBindings(string applicationName)
+ {
+ var siteBindings = new List<string>();
+ if (!String.IsNullOrWhiteSpace(_settingsResolver.ServiceSitesBaseUrl))
+ {
+ siteBindings.Add(applicationName + "." + _settingsResolver.ServiceSitesBaseUrl);
+ }
+ return siteBindings;
+ }
+
private void RemoveAcls(string appName, string appPoolName)
{
// Setup Acls for this user
View
3  Kudu.Web/App_Start/Startup.cs
@@ -63,12 +63,13 @@ private static void SetupKuduServices(IKernel kernel)
string serviceSitePath = ConfigurationManager.AppSettings["serviceSitePath"];
string sitesPath = ConfigurationManager.AppSettings["sitesPath"];
string sitesBaseUrl = ConfigurationManager.AppSettings["urlBaseValue"];
+ string serviceSitesBaseUrl = ConfigurationManager.AppSettings["serviceUrlBaseValue"];
serviceSitePath = Path.Combine(root, serviceSitePath);
sitesPath = Path.Combine(root, sitesPath);
var pathResolver = new DefaultPathResolver(serviceSitePath, sitesPath);
- var settingsResolver = new DefaultSettingsResolver(sitesBaseUrl);
+ var settingsResolver = new DefaultSettingsResolver(sitesBaseUrl, serviceSitesBaseUrl);
kernel.Bind<IPathResolver>().ToConstant(pathResolver);
kernel.Bind<ISettingsResolver>().ToConstant(settingsResolver);
View
6 Kudu.Web/Web.config
@@ -20,8 +20,12 @@
Note: localtest.me is an external service that always points to 127.0.0.1
so the default value below can be used for local testing of the configuration.
-
+
+ Note: The service sites allways add a random port to the iis binding.
+ If you are behind a firewall, leave 'serviceUrlBaseValue' empty or use a local hostname
+
<add key="urlBaseValue" value="kudu.localtest.me"/>
+ <add key="serviceUrlBaseValue" value="kudu.localtest.me"/>
-->
</appSettings>
Please sign in to comment.
Something went wrong with that request. Please try again.