public static HostConfig NewInstance()
{
var config = new HostConfig
{
WsdlServiceNamespace = DefaultWsdlNamespace,
ApiVersion = "1.0",
EmbeddedResourceSources = new List<Assembly>(),
EmbeddedResourceBaseTypes = new[] { HostContext.AppHost.GetType(), typeof(Service) }.ToList(),
EmbeddedResourceTreatAsFiles = new HashSet<string>(),
LogFactory = new NullLogFactory(),
EnableAccessRestrictions = true,
WebHostPhysicalPath = "~".MapServerPath(),
HandlerFactoryPath = ServiceStackPath,
MetadataRedirectPath = null,
DefaultContentType = null,
PreferredContentTypes = new List<string> {
MimeTypes.Html, MimeTypes.Json, MimeTypes.Xml, MimeTypes.Jsv
},
AllowJsonpRequests = true,
AllowRouteContentTypeExtensions = true,
AllowNonHttpOnlyCookies = false,
DebugMode = false,
DefaultDocuments = new List<string> {
"default.htm",
"default.html",
"default.cshtml",
"default.md",
"index.htm",
"index.html",
"default.aspx",
"default.ashx",
},
GlobalResponseHeaders = new Dictionary<string, string> {
{ "Vary", "Accept" },
{ "X-Powered-By", Env.ServerUserAgent },
},
IgnoreFormatsInMetadata = new HashSet<string>(StringComparer.OrdinalIgnoreCase)
{
},
AllowFileExtensions = new HashSet<string>(StringComparer.OrdinalIgnoreCase)
{
"js", "ts", "tsx", "jsx", "css", "htm", "html", "shtm", "txt", "xml", "rss", "csv", "pdf",
"jpg", "jpeg", "gif", "png", "bmp", "ico", "tif", "tiff", "svg",
"avi", "divx", "m3u", "mov", "mp3", "mpeg", "mpg", "qt", "vob", "wav", "wma", "wmv",
"flv", "swf", "xap", "xaml", "ogg", "ogv", "mp4", "webm", "eot", "ttf", "woff", "woff2", "map"
},
AllowFilePaths = new List<string>
{
"jspm_packages/**/*.json"
},
DebugAspNetHostEnvironment = Env.IsMono ? "FastCGI" : "IIS7",
DebugHttpListenerHostEnvironment = Env.IsMono ? "XSP" : "WebServer20",
EnableFeatures = Feature.All,
WriteErrorsToResponse = true,
ReturnsInnerException = true,
DisposeDependenciesAfterUse = true,
LogUnobservedTaskExceptions = true,
MarkdownOptions = new MarkdownOptions(),
MarkdownBaseType = typeof(MarkdownViewBase),
MarkdownGlobalHelpers = new Dictionary<string, Type>(),
HtmlReplaceTokens = new Dictionary<string, string>(),
AddMaxAgeForStaticMimeTypes = new Dictionary<string, TimeSpan> {
{ "image/gif", TimeSpan.FromHours(1) },
{ "image/png", TimeSpan.FromHours(1) },
{ "image/jpeg", TimeSpan.FromHours(1) },
},
AppendUtf8CharsetOnContentTypes = new HashSet<string> { MimeTypes.Json, },
RouteNamingConventions = new List<RouteNamingConventionDelegate> {
RouteNamingConvention.WithRequestDtoName,
RouteNamingConvention.WithMatchingAttributes,
RouteNamingConvention.WithMatchingPropertyNames
},
MapExceptionToStatusCode = new Dictionary<Type, int>(),
OnlySendSessionCookiesSecurely = false,
AllowSessionIdsInHttpParams = false,
AllowSessionCookies = true,
RestrictAllCookiesToDomain = null,
DefaultJsonpCacheExpiration = new TimeSpan(0, 20, 0),
MetadataVisibility = RequestAttributes.Any,
Return204NoContentForEmptyResponse = true,
AllowJsConfig = true,
AllowPartialResponses = true,
AllowAclUrlReservation = true,
AddRedirectParamsToQueryString = false,
RedirectToDefaultDocuments = false,
StripApplicationVirtualPath = false,
ScanSkipPaths = new List<string> {
"obj/",
"bin/",
"node_modules/",
"jspm_packages/",
"bower_components/",
"wwwroot_build/",
#if !NETSTANDARD1_6
"wwwroot/", //Need to allow VirtualFiles access from ContentRoot Folder
#endif
},
IgnoreWarningsOnPropertyNames = new List<string> {
Keywords.Format, Keywords.Callback, Keywords.Debug, Keywords.AuthSecret,
Keywords.IgnorePlaceHolder, Keywords.Version, Keywords.VersionAbbr, Keywords.Version.ToPascalCase(),
},
XmlWriterSettings = new XmlWriterSettings
{
Encoding = new UTF8Encoding(encoderShouldEmitUTF8Identifier: false),
},
FallbackRestPath = null,
UseHttpsLinks = false,
#if !NETSTANDARD1_6
UseCamelCase = false,
EnableOptimizations = false,
#else
UseCamelCase = true,
EnableOptimizations = true,
#endif
DisableChunkedEncoding = false
};
Platform.Instance.InitHostConifg(config);
return config;
}