OWIN Authentication in subdomains - owin

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.

Related

Turning on Anonymous Authentication, but IIS is still sending 401 with kerberos/windows auth request

Ok, so on my new site bob.testing.com, I set it up as anonymous authentication. Under it, i have a folder called apps. That's not an app, and there's no configuration on it. Under apps, I have a folder called MyApp. Originally, I set this up as Windows Authentication, but later I needed to update it to Anonymous. If I rename this folder to MyApp2 and create the application it works with Anonymous Authentication. When I rename it back... it sends back 401. I've tested with Fiddler, tried changing browsers, had someone else at work try it. Same results. I've tried recycling app pool, changing app pool, restarting IIS...
Anyone know how to delete whatever information IIS has cached about this application? I'd prefer not to have to rename and refactor my other apps for this item.
So, after posting; I actually looked here:
C:\Windows\System32\inetsrv\config\applicationHost.config
It was listed with two location path's. I ended up just deleting both and then setting it up again as an application. It appears to be working for now...
Looked something like this:
<location path="bob.testing.com/apps/MyApp">
<system.webServer>
<security>
<authentication>
<anonymousAuthentication enabled="false" />
<windowsAuthentication enabled="true" />
</authentication>
</security>
</system.webServer>
</location>

How to forward to Lightswitch html client from domain root deployed on Azure Websites

I have successfully deployed a Lightswitch HTML application to Azure Websites. I have also forwarded my personal domain to mask the azurewebsite.net address. I am now able to access the site by typing mydomain.com/htmlclient and everything works fine. If I type in just the my domain.com, however, I get the you do not have permission error.
This is close but ultimately I would like to be able to enter just the domain and have it automatically forward to the htmlclient folder. I know it is possible but I'm not sure if I can get there with settings in azure or my domain host or if I have to drop a page in the root (it appears that the default and login.aspx pages for forms authentication are already in the root).
Any help would be appreciated.
In the Visual Studio 2013 version we've found this is simply a case of adding an additional entry to the LightSwitch server project's web.config file.
This additional entry needs to reference the default.aspx file (which should already be part of the server project) and should be introduced into the defaultDocument section of the web.config. In the following example, this new line appears immediately after the standard default.htm line: -
<defaultDocument>
<files>
<clear />
<add value="default.htm" />
<add value="default.aspx" />
</files>
</defaultDocument>

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.

ASP pages in IIS using Localhost 401.3 Error do not have permission

I have just installed the IIS so I can view asp files in a browser but when I put the address in a browser as : http://localhost/index.asp I get an error.
The error shows this:
HTTP Error 401.3 - Unauthorized
You do not have permission to view this directory or page because of the access control list (ACL) configuration or encryption settings for this resource on the Web server.
I really need to get this sorted out, I would highly appreciate any advice on this.
My issue was around the identity used in the app pool. I changed the site's Authentication to "Application pool identity" as well as giving the directory the appropriate permissions.
OK, working from memory here as I am not in front of a Windows machine.
If you right click on your webroot folder /inetpub/wwwroot/ or the website directory you are working on open properties and select security, I think it is, you will see the list of users with their permissions for that folder. There is a section to add new users where you can add the IIS_IUSRS account (search from the list of users if you need to) which will be the default user used when anonymous authentication is enabled. Give this account the relevant permissions (read, write, execute) ensuring you apply to file and subfolders. Refresh the website in IIS and you should hopefully be good to go.
I had one folder not working (extracted from a zip file which came from an email from some kind of MS Sharepointy thing. Or something). The files were all marked with Windows Explorer -> Right Click -> Properties -> Advanced -> Encrypt contents to secure data. Unticking cured it.
In my case I had created an application in IIS 7 on Windows 7 using "Add Application" on the Default Web Site. I had to add the "users" account from the local machine and that got rid of the permissions error.
I had this happen to me and what I needed to do was apparently add a web.config file. Doesn't matter that it was just a PHP site, and that "Everyone" had full control. Until there was a basic Web.config - NO DICE!
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers accessPolicy="Read, Execute, Script" />
<defaultDocument>
<files>
<clear />
<add value="index.php" />
<add value="Default.htm" />
<add value="Default.asp" />
<add value="index.htm" />
<add value="default.aspx" />
</files>
</defaultDocument>
<directoryBrowse enabled="false" />
</system.webServer>
</configuration>
Here, the set up process is explained in detail. You can follow the steps.
http://coldfusion-tip.blogspot.com/2013/10/you-do-not-have-permission-to-view-this.html

WCF: Multiple bindings on TCP.NET

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...

Resources