SignalR Not Working with Windows Auth - windows

I've created a test MVC5 application to run the simple SignalR chat client shown here and everything worked as the tutorial described.
http://www.asp.net/signalr/overview/getting-started/tutorial-getting-started-with-signalr-and-mvc
I've then created another project where I enable Windows Authentication and my messages are not being received by the chat clients. However, my message requests are hitting the "ChatHub" Send method but my chat clients are not receiving the messages. Everything is identical to the original tutorial except for adding Windows Authentication. Any ideas what could be my problem? Thanks in advance.
jquery.signalR-2.1.2.min.js

Appears to be a user error. I jumped between the original SignalR tutorial and SignalR with MVC5 tutorial and ran into a discrepancy. Original SignalR tutorial had chat.client.addNewMessageToPage" and the SignalR with MVC5 tutorial "chat.client.broadcastMessage" and I must have botched the copy and paste job between projects and tutorials. Feeling a little sheepish at the moment.

Related

Skype for Business channel doesn't pass authentication credentials correctly

I have a .NET Bot Framework bot created using the template and tested on other channels and in the dashboard.
I've added the Skype for Business channel and performed the PowerShell cmdlets for my tenant. However, I constantly get the reply "Error happened in contacting target user".
I looked in the Bot Framework Dashboard for issues, and the problem is that the Bot Framework is getting back a 401 Unauthorized from my code. Remember that this works fine in other channels.
Suspecting a problem with how Skype for Business passes (or doesn't pass) the authentication tokens I commented out the BotAuthentication decorator. Suddenly everything works fine. So I think there's a problem with the Skype for Business channel and how it passes the authentication credentials, as this situation clearly isn't ideal.
Just to answer my own question on this. The reason I was seeing this problem was because I did not have the latest version of Microsoft.Bot.Builder. I needed to be running 3.5+ and I wasn't. I've written it up here (along with instructions for updating the NuGet package if you need that): https://blog.thoughtstuff.co.uk/2017/06/how-to-enable-your-bot-framework-bot-on-skype-for-business-part-2-or-how-i-followed-the-instructions-and-it-worked/

Bot Framework always getting unauthorized response

I started using Microsoft Bot Framework and followed step by step all tutorials.
I has been able to register a new bot and to deploy it working good with emulator, but except it nothing else works.
Test connection to your bot chat do not works despite I get answer from emulator and from all connected channels, that where created and registered properly I always get an Unauthorized response or something like that, anyway no response, so nothing works.
I tried with Twilio, Web Chat, Telegram (Skype auth is pending) getting always the same response.
As it seems I strictly followed the tutorials, is there something else to do or to be approved? Or just the service is still not working at 100% as too young?
Thanks
If you are using HTTP you need to disable basic auth because the connector won't send your appSecret in the clear.
The solution is to make sure you register as HTTPS, or if you need to use HTTP then disable the basic auth.
Took me a while to get it working locally too. Oddly for me it only works when those 'secret' fields are empty, as mentioned and running in debug.
Running without debugging seems to always result in a 401
Hi I was facing same problem to work bot locally in v3. I just made everything blank in web.config and it is working.
I solved the problem.
It was related to https. It's not well explained into tutorial but when you create and publish a service in Azure it is created as http://XXXXXXX.azurewebsites.net as shocased into tutorial, but it will not work as your service must run in https.
I so used https://startssl.com to create a free ssl certificate then turned on SSL into my Azure service so everything started working.
I've cleaned up the getting started with the following; hopefully it will make it clearer for the next person who uses it:
Click the “Register a Bot” button and fill out the form. Many of the fields on this form can be changed later. Use a the endpoint generated from your Azure deployment, and don’t forget that when using the Bot Application template you’ll need to extend the URL you pasted in with the path to the endpoint at /API/Messages. You should also prefix your URL with HTTPS instead of HTTP; Azure will take care of providing HTTPS support on your bot. Save your changes by hitting “Create” at the bottom of the form.
Make sure you are using HTTPS. BotFramework will not work with basic auth so tokens are not passed in the clear.
See: http://docs.botframework.com/connector/calling-api/
Make sure that you republish your bot service after registering and getting the app Id and password. If you fail to do this you will get Unauthorized. The steps are 100% clear on this and I hit this for a minute.

Can't connect to new CRM Online Security model with XrmDataContext

Microsoft has changed the authentication model for new CRM sites from LiveID to Microsoft Online Services. I set up a new site this week and have it up and running but code I wrote that connects to the site using early bound classes fails to authenticate.
My connection string for an older site using LiveIDs looks like this.
I am trying to connect to the new site that uses Microsoft Online Services for authentication with this connection string
I create an instance of XrmDataContext and it seems to work OK until I actually upll data fromthe site. The error I receive is
ACS10002: An error occurred while processing the SOAP body. ACS50012: Authentication failed.
I tried all of the authentication types list here http://technet.microsoft.com/en-us/library/ff681567 and none seemed to work.
I see a lot of forum posts saying that the discovery service URL has changed so I tried adding that to my connection string.
Discovery URL=https://disco.crm.dynamics.com/XRMServices/2011/Discovery.svc
No luck.
Has anyone written code that connects to the new security model? Did you do anything special?
Thanks in advance,
Bill Wolohan
MS released a new version of the SDK on 8/17/2012. I had downloaded the latest on 8/16/2012 and that version did not work. Once I downloaded the newer version and recompiled it worked great. I just had bad timing. :-(

Asynchronous Post with HttpWebRequest in MVC3

I've run come across a behavior with HttpWebRequest that I believe is intended, but as I have not been able to find any source that definitively says this is correct, I thought I would post it as a question and see if anyone has encountered this and/or can verify this is correct.
For starters I have an MVC3 app running on IIS 7.5. It has 1 controller and supports 1 post method. I have Windows Auth and ASP.NET Impersonation enabled within IIS. The idea behind the MVC3 app is just to have a simple service that can be used for logging information from a variety of client applications(console apps, silverlight, asp.net, AJAX, etc). One of the things the service does is uses the User property from the controller to also log who the person who posted data to this service.
To simplify the processing for the consuming applications I created some client libraries, Silverlight, DotNet, and a js library.
This all worked out as expected except when using the DotNet library within another MVC3 application. For the DotNet library I'm using an HttpWebRequest and using the asynchronous methods (Begin/EndGetRequestStream)/(Begin/EndGetResponse) to post the request. I'm also setting the .Credentials on the request to CredentialCache.DefaultCredentials, but when the logging application starts the processing of the request from another MVC3 app it shows the User as the service account of the app pool from which the post was received.
When I found this I added a synchronous version of the post to the DotNet library and found that the logging service was using my personal credentials.
I assume that HttpWebRequest could be using different DefaultCredentials depending on the context in which it is used. Since this is asp.net and the async method of the request are being called, my library code may not have even finished before the client MVC3 app has returned a response.
What I haven't been able to find is if this is definitively the case or not. If anyone has and answer or or an article that could point me in the right direction I would greatly appreciate it.
Thanks in advance
What I was encountering was intended behavior. The root of the problem comes down to under which identity do threads from the .Net thread pool execute when servicing the asynchronous requests. In my case the threads were executing as the owner of the app domain that was created by the app pool. In my case it was a service account.
I was able to capture the identity of the impersonated user prior to the start of any asychronous processing and use the WindowsImpersonationContext to force my library code to run as the impersonated user. By doing this CredentialsCache.DefaultCredentials used my credentials(impersonated user) instead of the account running the app pool when setting it on the HttpWebRequest instance.

Can the netduino board send and receive directly to and from my appharbor app?

Hi i would like to send data from my netduino board directly to my app that is hosted on appharbor, I couldn't find any examples. I may be asking the question wrongly, if so thanks for you patience.
:)
This post has resources on how to send http reqeusts from .NET Micro Framework apps. If you send JSON from the board, you can receive in an ASP.NET MVC 3 action on AppHarbor. There's an example on this question: Receive JSON from external server, parse it and save it to local database with MVC2
http://netduinohacking.blogspot.com/ has a good example.

Resources