OAuth callback URI changes port number in Azure emulator - azure

I've developed a working solution using Azure SDK October 2012. It connects to another service that uses OAuth. When I move my solution to a machine using Azure SDK 2.1, the OAuth callback fails because the port number has changed.
For example, when I debug the solution it opens a browser at 127.0.0.2:82. Then I connect to the other service, and the callback comes to 127.0.0.2:83, which the browser can't find. Prior to being redirected to the other service, I can see that the controller is looking at the Request object and getting the invalid port # (83) from that.
I'm not a MVC or Azure whiz, but this solution works perfectly under the older version of the SDK. Did something change? btw I've tested this with IE10 and Chrome, so it's not a browser issue.
Just to be clear - I have the exact same solution running on 2 machines. One works, and the other doesn't. So it's not a problem with my code, unless there's something that explicitly needs to change for Azure SDK after October 2012.

The Oauth2 app has been configured to redirect on specific site + port, so either you need to reconfigure the Oauth2 configuration in the OAuthProvider
or else see why the emulator locally is binding to a different port. Maybe the other port is being used by some other site running in the emulator. Sometimes just restarting the emulator does the trick.
See this to understand how the local emulator works.

I was missing the [Authorize] attribute on the controller method that was looking at the Request object. When I added that, the port number problem went away.
Still not sure why it worked on one dev machine and not the other (or with one version of Azure SDK and not the other), but now it works on both, so there you have it.

Related

SharePoint server 401 Unauthorized from the local machine

I have installed a SharePoint 2013 in my Windows server 2012 development environment. I have configured everything and it worked fine. The problem is that from the machine where the SharePoint is hosted, it asks me for the credentials in a loop, it always responds with 401. If I access from another PC it works. I am using the same DNS to access from both sides. My authorization is with windows.
The above does not matter to me, my problem is that I have an asp.net API on the same server that makes use of ClientContext to connect to this SharePoint. When the API is hosted on the server and makes a request using the ClientContext, it returns a 401. If my API is on my computer launched from visual studio there is no problem. In addition, I have also tried to deploy the API in another environment but pointing to my development environment and everything works fine.
The problem is when I try to access from the same machine where SharePoint is hosted. (The central administration works without problems).
I answer my question.
The problem is related to Loopback Check. It must be disabled for calls from the SharePoint server itself to work.
To disable it go to the registry Ctrl+R and type regedit.
Enter: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa and
add DWORD (32-bit) Value.
The name is as follows: DisableLoopbackCheck.
The value in hexadecimal is: 1
I add the post where I found the solution.
After this it works correctly!

The DefaultHttpHandler.BeginProcessRequest method is not supported by IIS integrated pipeline mode

We are having issues in hosting Webforms apps in one of the windows 2012 servers and IIS8.5. The server causes "DefaultHttpHandler.BeginProcessRequest method is not supported by IIS integrated pipeline mode" exception.
Attaching a screen shot for your reference
However when I tested in another server it works all fine. To isolate issues I have even tried to deploy a sample webforms app and try out.
I need integrated mode pipe line as I have a requirement around it.
I have verified the servers and there is no difference in iis configurations. What could be the possible reasons for this? Any guidance to narrow down the issue will really help.
Attaching the server comparison report. The image shows the differences in two servers. in the right side server the application does not work and in the left side server it works. If you see the diff there is not a lot of changes and btw the changes are because I added them as part of trouble shooting.
We compared every possible stuff on the servers and finally decided to take up the server in which it is working. The server in which it didnot work might have some issues with they way IIS was deployed.
So in a way there was no way out for this problem for me.

NTLM on IIS 8.5 on Server 2012, second web site failing

Maybe you'll be able to help me out.
My situation is this:
We are migrating to from Win2003 to Win2012. We've got multiple web sites configured on the 2003 box and we can browse to each of the different names no problem at all, using Windows Integrated.
Well, we just fired up a Windows 2012 and started migrating to it but running into an ntlm 401 issue (log says specifically 401.2.5).
Changing the names to protect the innocent here:
Server Name: Server
going to http://server/apps/asmx/servivce.asmx works fine.
We have a second IP assigned to a new the same box, on port 80, but configured so we can go to http://conapps/apps/asmx/service.asmx. That should work, and return a simple wsdl, but it doesn't.
if we go to http://conapps/apps/anonymous/asmx/service.asmx, it works fine.
I've gone into the authentication tab, and have windows Integrated (and NTLM bubbled up to the top) but I keep getting the 401 errors. Ironcially, if I set anonymous on, it works as expected.
As I said, if I take the default web site, and configure it to point to the same physical files on the disk, it works fine. It's only when I try to go to the secondary name do I have problems.
So, anybody have any ideas what I might be missing?

Azure Mobile Services on Local IIS rather than IIS Express

OK, I've created an Azure Mobile Services project in Visual Studio 2013.
I run it up as-is, then in the browser I test it by adding a todo item via the simple browser app that seems to get baked into these service projects. It gives me a '201 success' message - brilliant.
I then convert the project from IIS Express to Local IIS as the web host, recompile and try again, and although I get the same smiley face app telling me that everything is OK, when I try and add a todo item I get a 404 error. This is contrary to the Microsoft article that gives these instructions, which clearly says I am able to choose either IIS Express or Local IIS when setting up the project.
My guess is that web.config is missing something when this project runs on the local IIS server.
I'm hoping someone already has a solution before I spend hours trying to work out how to configure IIS for this type of project.
I've already wasted a load of time working through loads of bugs and gotchas with Azure Mobile, and I'm starting to run out of steam - so I'm hoping someone can help me before I go and grab an account at Parse.com
Many thanks in anticipation.
Dean
The easiest approach for your situation might be to just deploy to the cloud, and use that service for your testing. Visual Studio 2013 Update 2 makes it easy to deploy your app and connect to it for remote debugging. It is a little slower than using a local instance, but you are also assured that there will be no surprises when you eventually go live (since you are live the whole time).
That said, we will investigate the issue you are seeing with using IIS directly. Some things you might want to try on your own:
Verify that you can view the web side from your Mac's browser, to make sure that the firewall is letting the requests through.
Try using the "Getting Starting" link from the smiley-face page, to see if the REST endpoints are behaving correctly.

How to configure Web role on Azure Compute Emulator to work like local IIS (static URL)

So, the question is how to configure Web role on Azure Compute Emulator to work like on local IIS? By this I mean, that, the web role have the fixed url (like you can in project properties set the "Use Local IIS Web server" and set the fixed url)?
How to set Azure Compute Emulator to work on static url or at least at static port?
Is is really annoying that everytime I start the web role I have different url (port)!
The answer is that you cannot run it on a static port, but it should run on the first available port in its port range (starting at 80 and incrementing until it finds a free port). If it increments with every "debug" session starting, then it's because the previous emulator didnt teardown completely before you started a new one.
There are some ideas how to fix this issue here:
http://social.msdn.microsoft.com/Forums/en/windowsazuredevelopment/thread/ae2df7e0-5005-4bcd-8b69-bb53323eb589
Check out this solution from Michael Collier [a fellow Windows Azure MVP]

Resources