Callback URL in Skydrive API to localhost - c#

I am trying to implement SkyDrive API into my Asp.net mvc3 application.I tried to create app in Microsoft using this tutorial for implementing user authentication , but I am facing a problem in Callback Url, because Microsoft forces me to add a real domain and I want to use my localhost in order to develop it right now.

Alternatively you could add a fake domain to your
/etc/hosts (Linux)
C:\Windows\System32\drivers\etc\hosts (windows)
file. Just add the following lines:
127.0.0.1 www.yourfakedomain.de
After adding that line you can choose in Microsoft OneDrive App-Center something like
http://www.yourfakedomain.de/blabla.php
as your redirect uri.
Since your operating system thinks that domain belongs to localhost you will be able to get your authentication code just normally at your local test domain ;-)

How would SkyDrive call code on your local machine?
One way to do it is to first mock SkyDrive in your application -- that is, you don't call the real SkyDrive, just a service that you have running locally that acts as if it is SkyDrive. You can use that to develop and debug your application to some extent.
Then you can deploy your application to a test server on the Internet, so that SkyDrive can do the callback, and you can test it there and make the necessary modifications before you deploy to an actual production server.

I find a solution for my problem, I used pageKite to solve my problem. pagekite gave me an alternative to my localhost by mapping my localhost to a real domain. so I added that domain to my app in Microsoft and its working.

Related

Evernote Download C# Backend Process

I have a back-end process that I would like to use to connect to Evernote and download some notes. I thought I could use the developer token which I used successfully in the sandbox environment but when I tried to set it up in Production the Evernote support team said that it was discontinued and not allowed to be used in Production.
I then tried to use the
ENSession.SetSharedSessionConsumerKey
but that brought up a web browser to verify that I could use the service. The problem is this is a back-end process and I don't want a manual step of clicking the authorization web form.
Has anyone have a solution to do this?

Application Insight on premises without Internet Access

I've to develop a WPF application in an intranet environment with no internet access for security reason. I was wondering if it's possible to collect data locally (on a server) then to FTP them or even better to have the application insight alternative installed on a Server.
Has anyone faced a similar situation and have been able to solve it?
You could do something like that yourself if you really needed to. Instead of using the built in InMemoryChannel or ServerChannel classes to send telemetry, you'd create your own implementation to store them somewhere else. (or you could change the endpoint that the default channels point to to a web service inside the intranet.
you could then collect those files up and ftp them outside, and write another service to read those files and send the telemetry to app insights. Though it seems less like a good idea given the intranet with no internet for security reasons.
Or, better yet, you could simply write internal service to parse and store all that telemetry and show it on that web service inside the intranet and use appinsights only as an sdk and schema, and don't send any of your data outside your intranet at all.
More likely: upvote adding AI to azure stack, (https://feedback.azure.com/forums/357324-application-insights/suggestions/11683746-bring-application-insights-to-azure-stack) and then get an azure stack implementation inside your intranet? then you get all the other goodies of Azure from Azure stack as well.

Deploy WebAPI to external website

We have a public website that is already exposed to the outside, although in reality there's really nothing there. Simply default.htm file with "Coming Soon" text in it. (http://vensuresoftware.com/)
We also have a WebAPI we've put together that we want to add to this website. When I publish locally to my IIS6, it works no problem. It's accessed as http://localhost/HRConnect/api/Claims just fine. I've used PostMan, a C# client, and Javascript AJAX to access this just fine. I can also load it in a browser at that URL, and I get the appropriate default controller and action.
However, I have been totally unable to accomplish this same thing on the website. Ideally I'd like to include it as a Virtual Directory to the http://vensuresoftware.com and access it as http://vensuresoftware.com/HRConnect/api/Claims but I've had zero luck doing so.
I have tried to add it as a Virtual Directory as well as an Application under that specific website, but when I access the URL, all I get is "The resource you are looking for has been removed, had its name changed, or is temporarily unavailable."
I've ensure the Application pool is correct, with an appropriate user and the pass through connection test succeeds. But I just cannot access the service or the URL.
Any ideas or suggestions at all on what I can try? I'm not sure what else I can include here. Nothing special in IIS, nothing special in the service really. There's only 3 actions in it. As I said, it all works beautifully locally, under localhost though.
IIS 7 doesn't have built-in support for extensionless URLs which causes a lot of headaches trying to get MVC and Web API apps to run. I've gotten it to work using both these options. Pick the one that applies to you.
Install this IIS patch which allows IIS 7 to handle extensionless URLs.
If the patch isn't an option because you're worried about breaking other sites on the server, you can make the Web.config adjustment found in this answer. You'll have to do this for every MVC/Web API app you have running on the server.

Load Testing Azure Web App with OAuth2

I'm trying to wrap my brain around setting up load testing secure azure web applications. I want to push a load test to the cloud, which is pretty simple given we are using VS online. However, when running multiple users I get several errors. I think the errors revolve around a single account trying to gain authorization to web app simulated with multiple 'virtual users.'
Errors: https://login.microsoftonline.com/common/login----{POST} Context parameter $HIDDEN1.ctx not found in test context
https://mysite.azurewebsites.net/----{POST} Context parameter $HIDDEN1.code not found in test context
a slew of socket exceptions:
https://localhost:port/skypetoc/v1/pnr/parse----{POST} connection actively refused
ValidateResponseUrl errors
https://mysite.azurewebsites.net/----{GET} The value of the expectedresponseUrl property 'https://login.microsoftonline.com/common/oauth2/authorize does not equal the actual response url https://mysite.azurewebsites.net querystring parameters were ignored.
running this test locally with a single user account works fine. pushing to the cloud under a single login account with multiple simulated users yields all these errors.
Questions:
1. Do I need to create n number of user accounts for this to work properly?
2. Do I just need to create custom plugins at the request level to get new auth tokens per user request?
3. Is there any built in support for this kind of stuff in Visual Studio Online Azure load testing?
I really don't want to test the performance of login since its out of my hands. but I do want to test the performance of my web app under load for other functions.
Visual Studio Online does not allow localhost to be the hostname in your callback URL. You can edit the hosts file on your local computer to map a hostname to 127.0.0.1. Then use this hostname when you register your app. Or, you can deploy your app when testing to a Microsoft Azure website to be able to debug and use HTTPS for the callback URL. See: https://www.visualstudio.com/en-us/integrate/get-started-auth-oauth2-vsi.aspx

How can I create a WCF service that allows users to connect to my service through a web browser and upload a file?

I've created a Hello World WCF service that uses the ASP.NET Development Server - I launch the client which opens a page in my web browser, HelloWorldService.svc, then this triggers the command prompt to open and print out a Hello World message.
I don't fully understand this chain of action or how it's useful.
I'm trying to create a WCF service that acts as a server that allows users to connect to the server and perform a file upload - I will take this file and store it locally on my machine.
For now, allowing this to work locally on only my PC is fine but I really don't know where to begin to accomplish this. Any advice would be appreciated.
EDIT: I NEED to use WCF. So please don't suggest alternative solutions.
WCF is arguably overkill. Simplest case, just use the standrad .Net FileUpload control.
Here are some examples:
ASP.NET File Upload
http://asp.net-tutorials.com/controls/file-upload-control/
Which leads to the question "When should I use WCF"? Here are a couple of answers:
When & where I should use WCF
http://forums.asp.net/t/1480028.aspx
http://msdn.microsoft.com/en-us/library/cc512038.aspx
http://forums.asp.net/t/1478962.aspx
Finally, here are a couple of links that describe WCF-based file transfer services:
http://www.codeproject.com/Articles/166763/WCF-Streaming-Upload-Download-Files-Over-HTTP
http://code.msdn.microsoft.com/windowsdesktop/Upload-files-using-a-REST-13f16af2

Categories

Resources