WCF: Multiple bindings on TCP.NET - c#-4.0

I am trying to set up a website under IIS 7.5 with multiple tcp.net bindings.
Since the service is behind a loadbalancer I need multiple endpoints for the service:
log.o1881.no/log/service.svc
log.core1.o1881.no/log/service.svc
this works for the http bindings when I configure in web.config:
<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
The following error message appears when the following tcp.net bindings are added to the site:
808:log.o1881.no
808:log.core1.o1881.no
Server Error in '/Log' Application.
This collection already contains an address with scheme net.tcp. There can be at most one address per scheme in this collection. If your service is being hosted in IIS you can fix the problem by setting 'system.serviceModel/serviceHostingEnvironment/multipleSiteBindingsEnabled' to true or specifying 'system.serviceModel/serviceHostingEnvironment/baseAddressPrefixFilters'.
Parameter name: item
I also tried to add this to web.config:
<serviceHostingEnvironment multipleSiteBindingsEnabled="true">
<baseAddressPrefixFilters>
<add prefix="net.tcp://log.o1881.no:808/log" />
<add prefix="net.tcp://log.core1.o1881.no:808/log" />
</baseAddressPrefixFilters>
</serviceHostingEnvironment>
This does however not work.
Since the service will be deployed on multiple servers, I would very much like to be able to make this work through configuration and IIS setup, not in code.
Is this possible to do, or is there another way to handle this scenario (multiple binding names on http and net.tcp, due to loadbalancing)?

According to the documentation the use of multipleSiteBindingsEnabled tells WCF to ignore any <baseAddressPrefixFilters>.
"Any baseAddressPrefixFilters settings are ignored, for both HTTP and non-HTTP protocols, when multiple site bindings are enabled using this setting."
So this configuration contradicts itself, you are specifying address prefixes and simultaneously instructing WCF to ignore them since you are have multipleSiteBindingsEnabled specified.
<serviceHostingEnvironment multipleSiteBindingsEnabled="true">
<baseAddressPrefixFilters>
<add prefix="net.tcp://log.o1881.no:808/log" />
<add prefix="net.tcp://log.core1.o1881.no:808/log" />
</baseAddressPrefixFilters>
</serviceHostingEnvironment>
I think the multipleSiteBindingsEnabled is best for scenarios where you are only interested in using HTTP schemes.
Otherwise don't use it and you can in fact have multiple tcp.net bindings on different ports in the same IIS Site/App hierarchy.
<serviceHostingEnvironment>
<baseAddressPrefixFilters>
<add prefix="net.tcp://log.o1881.no:808/log" />
<add prefix="net.tcp://log.core1.o1881.no:808/log" />
</baseAddressPrefixFilters>
</serviceHostingEnvironment>
Hope this helps others :)

For as far as I've found, this is impossible:
Supporting Multiple IIS Site Bindings
Endpoint Addresses
How can WCF support multiple IIS Binding specified per site ?
If anyone finds a solution for this, please share...

Related

OWIN Authentication in subdomains

For last 1 day, I'm trying to access a simple RDLC based project from my main project using virtual directories.
But this shows an error as,
Here, I don't want to mark <add key="owin:AutomaticAppStartup" value="true" /> as false. How can i overcome this issue?
Sharing authentication between two web applications
I added a seperate owin:AppStartup value for my child application, under appSettings as shown below:
<add key="owin:AppStartup" value="SampleReport.Startup,SampleReport"/> which made this application accessible under my parent application.

Application Insights not capturing https traffic

We have an Azure web app with AI configured.
The module from AI is added like this:
<modules >
<remove name="ApplicationInsightsWebTracking" />
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" />
</modules>
We want the precondition, because we don't want static files to be captured but when using the precondition, https traffic never gets captured, while http traffic does.
Any ideas how to use the precondition="managed" but making sure https traffic is also captured by AI?
For one or the other reason, adding the httpmodule for classic mode solved my problem.
Anyone who can explain this?

Configuring Coldfusion On IIS

I have to export a classic asp/asp.net 2.0 web site that uses also coldfusion 8, from Windows Server 2003 with IIS6 to Windows Server 2012 and IIS 8.
I got everything working except setting up coldfusion to work with IIS.
The pages using coldfusion have .cfm as an extension.
I tried to follow this link here but that did not work
http://www.adobe.com/devnet/coldfusion/articles/iis-configuration.html
When I try to add the handlers in IIS, I see a warning saying this site is in classic mode and I need to manage managed handlers directly in the config file.
I tried to add the handlers using appcmd like this:
appcmd set config /section:handlers /+[name='cfmHandler',path='*.cfm',verb='*',type='c:\coldfusion8\runtime\lib\wsconfig\jrun_iis6.dll',preCondition='integratedMode']
Then I added the Wildcard Script Map in IIS as per the link, this seems that it created and entry in the web.config of the site.
<system.webServer>
<handlers>
<add name="JWildCardHandler" path="*" verb="*" modules="IsapiModule" scriptProcessor="C:\ColdFusion8\runtime\lib\wsconfig\1\jrun_iis6_wildcard.dll" resourceType="File" requireAccess="None" preCondition="bitness32" />
</handlers>
</system.webServer>
When I try to browse to the web site, if the wildcard handler exists in the web.config, I get error 404 on any page, even the one that does not end with .cfm
I removed the wildcard and I now get the following error:
Handler "cfmHandler" has a bad module "ManagedPipelineHandler" in its module list
Most likely causes:
Managed handler is used; however, ASP.NET is not installed or is not installed completely.
There is a typographical error in the configuration for the handler module list.
During application initialization, either the application initialization feature has set skipManagedModules to true, or a rewrite rule is setting a URL that maps to a managed handler and is also setting SKIP_MANAGED_MODULES=1.
I tried to run the fix that some programmers mentioned in other questions, but did not help
c:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis -i
I tried to add the handler in the web.config instead of doing it through appcmd but I got the same error.
<add name="cfmHandler" path="*.cfm" verb="*" type="c:\coldfusion8\runtime\lib\wsconfig\jrun_iis6.dll" preCondition="classicMode" />
I have been trying to get this to work for the last 3 days without luck.
All I need get done is to make any page that ends with .cfm handled by the coldfusion server. It's obviously the web site is old .NET and probably classisMode. I could not find simple step by step instructions other than the link above which did not work for me.
Thank you in advance

NetScaler/IIS: 413 Entity Too Large

I am facing an issue where I am getting a 413 Request Entity Too Large whenever I post/put JSON to our servers running IIS 7.5 through a Citrix NetScaler.
We have tried to set the aspnet:MaxJsonDeserializerMembers to 30000, 40000 and 512000, as so:
<appSettings>
<add key="aspnet:MaxJsonDeserializerMembers" value="xxx" />
</appSettings>
as well as setting the <jsonSerialization maxJsonLength="xxx"/>
But without any resolution.
Setting the aspnet:MaxJsonDeserializerMembers in our local test environment, where we don't have a Citrix NetScaler, works just fine .
Is there any settings in the NetScaler that I should know of? or Is there some IIS settings I have to be aware of as well, considering that this works in our local test environments I am leaning towards the later, but I wan't all basis covert.
Edit: After further investigation, it surely seems that the NetScaler is the source as we can post to the API from behind the NetScaler.
As it turns out, it was actually a combination between the two products.
Internally we use SSL and Client Certificates which means we needed to configure a IIS property called "uploadReadAheadSize"
http://forums.asp.net/t/1702122.aspx?cannot+find+uploadReadAheadSize+in+applicationHost+config+in+IIS7+5
This is done in the host config or though the IIS manager.
...
<system.webServer>
<serverRuntime uploadReadAheadSize="{BYTES}" />
</system.webServer>
...
We used 10 MB = 10485760 Bytes for now which shows to be enough. Since this is defaulted to 48KB you may reach this rather fast.

ServiceStack always Default Redirect to /metadata even when Default.cshtml present

I have a ServiceStack project with ServiceStack Razor added. Any time I try and navigate to the root of the site, I'm getting redirected to /metadata.
This does not happen on my dev machine, only in my hosted environment (AppHarbor).
I do have a Default.cshtml in the root of my project.
Navigating to other URLs work fine: /default1.cshtml, /myservicewithviews
I've tried messing with the DefaultRedirectPath in my AppHost, but that didn't help.
Trying to force it DefaultRedirectPath = "default.cshtml" result in a redirect loop. Which makes sense.
What is causing this?
AppHarbor only publishes files marked "Content" when building projects (AppHb FAQ). This file was the only one not marked content and why I was only experiencing this in my hosted environment and could access all other content.
Not detecting a default document causes ServiceStack to set a RedirectHttpHandler to /metadata - shown around here
Another noteworthy point is that AppHarbor's load-balancer causes their internal port numbers to show up in ServiceStack URLs when performing things like Response Redirects.
To fix this problem, you add the following to your Web.Config:
<appSettings>
<!-- AppHarbor Setting to stop AppHb load balancer internal port numbers from showing up in URLs-->
<add key="aspnet:UseHostHeaderForRequestUrl" value="true" />
</appSettings>
You could also configure this setting in your AppHarbor config panel.

Resources