CosmosDB DirectMode TCP is not working - c#

I'm developing an Azure CosmosDB project and we are now in the testing/optimization stages but we are facing an issue which, so far, has remained unanswered by the official documentation or other sources.
Essentially, whenever we use the .NET SDK configured under DirectMode and TCP protocol we alway hit an error regarding "Service is currently unavailable" or "Resource not found".
However, as soon as we remove this configuration from the .NET SDK client everything starts to work as it should.
I've found a couple github issues on this (as this one or this one for example) but on any of them does my use case apply.
I'm testing from a locally deployed WebAPI fetching data from an Azure Trial Account.
The documentation mentions that ports 10000-20000 should be open. I've manually added that configuration as well (Azure side) but still no success.
Is there any issue using this? Does this only work from within the same network? What's wrong?
Thanks

Related

Xamarin Forms - How to use HttpListener with HTTPS in 2022?

I have been working on this for a day or so and have come across quite a few posts and snippets which shed some light on how to run an HTTPS server using HTTPListener in Xamarin Forms, but everything I have come across is very outdated, or targets the wrong platform, (in most cases, Windows). I am targeting Android only at the moment, though would like to do the logic for the server in the shared code, as I will eventually deploy the app to iOS as well.
My main problem has been tracking down a comprehensive guide, or even a list of the steps required. For example, on the HTTPLIstener documentation page (https://learn.microsoft.com/en-us/dotnet/api/system.net.httplistener?view=net-6.0) the text mentions needing to select a Server Certificate for the listener, or it will fail. It then goes on to describe configuring the Server Certificate using Windows-specific tools which do not have an implementation in Xamarin.
I have encountered another post which mentions putting the certificate and private key in question into a specific folder, named after the port number the listener inhabits, i.e. 55555.cer and 55555.pvk. I have tried this, using a self-signed certificate generated using the BouncyCastle library, and it will not work. The HTTP version of the server works perfectly, but the HTTPS side generates an error like:
SSL_ERROR_RX_RECORD_TOO_LONG
This is the same error I was receiving before doing anything other than adding an HTTPS prefix to the listener, so it indicates to me that nothing has changed or been affected by placing the certificate in the correct location.
Finally, I have encountered information which leads me to believe that I need to also add the self-signed certificate to the Android Trusted Certificate store, before I will be able to use it in my application. I'm about to start implementing that, but wanted to check here to see if anyone has any insight to offer that will help me along the way.
So my question is: What are the actual steps required to make HTTPListener with HTTPS support on Xamarin Forms Android work?
It's seemingly been done in the past, so presumably it will still be possible today. I'd really like to use HTTPListener versus a lower level connection API due to the convenience offered.

Azure mobile app offline sync causing a MobileServicePushFailedException -> CancelledByAuthenticationError

As part of a UWP app we're developing at work, we have an Azure mobile app (C#, .NET backend) connected to the client which is supposed to sync up with offline SQLite storage and place CRUD operation requests into a queue so they can be processed by a worker role.
Trouble is, for some reason when we attempt to call PushAsync/PullAsync on the sync context and messages table respectively, it throws a MobileServicePushFailedException. When monitoring this in locals, the PushResult status is "CancelledByAuthenticationError" but this happens even after successfully logging in via one of the providers, and we haven't yet set the table to require authentication anyway so this shouldn't be causing any problems.
Interestingly enough, when this was a mobile SERVICE as opposed to a mobile app running in a Windows 8.1 project instead of a UWP, it worked fine, because the MobileServiceClient constructor in that version of the Nuget package takes the application key as one of its arguments. Unfortunately, we're developing a UWP, so it needed to be migrated and thus we can't use the same constructor any more.
Has anyone come across this before, or does anyone have any idea where we might be able to find further information on this? We haven't been able to find any other concrete references online besides another SO post that was asking about a similar but different issue, and a few other posts that either have no answers or are working with different languages/backends.

Azure web Application CodeFirst Error

I'm creating a Web Application in visual studio for an application.
On localhost, its working smooth, the problem comes when I port it to azure.
http://infolab.azurewebsites.net/api/users/getuserlist
This is the error I get in every single method of the API.
I've created a database in MySQL with MySql Workbench and used entityframework to implement his usage.
Any help?
Thanks
I was having what sounds like the same issue (Can't see the error on the link but my error was in regards to CODEFIRST/Entity issue), couldn't find answers anywhere that would work for me. After a day of trial and head slapping I came across a connection strings setting on Azure that I'd completely forgot I had set up.
Home > App Services > {YOUR APP} > Configuration
At the bottom of the page you'll find Connection Strings . If it is the same problem I was having you'll have at least one in the listings. This setting was overriding my connection strings in code and it was written in a code first format (no meta tag). I simply deleted the entry in Azure then re-published my code. Worked fine after that.
Connection String Section in Azure -> APP -> Configuration
Hope that helps somebody.

What is an event broker? and how do you configure one on windows 2008?

I am trying without complete success to create a wso2 identity server on a windows server 2008 vm. I followed the online instructions and installed the pre-requisits (jre and jdk), downloaded the zip file, setup the environment variables, and ran the wso2server.bat file. There were a lot of errors.
I then realized I needed to add active directory role on the server, which I did. It still wouldn't install. I did some more online research which led me to believe I needed to install wso2 esb as well, which I did. I was able to get that install to work and was able to create a desktop app to consume the web services. All well and good. but then as part of the requirements they wanted to enable passive sts with an asp.net client (not really sure what that is), so I went back to the identity server and am still getting errors while running the bat file, though I an able to run the gui from the browser, but unable to log in.
The exception I am getting is :
TID: [0] [IS] [2013-10-07 10:34:58,746] ERROR {org.wso2.carbon.event.core.internal.builder.EventBrokerHandler} - Can not create the event broker {org.wso2.carbon.event.core.internal.builder.EventBrokerHandler} org.wso2.carbon.event.core.exception.EventBrokerConfigurationException: Can not access the user registry
in addition, I am also getting authentication errors on some of the esb web calls, but not all, and I would also like to know how to change from the default user store (ldap or ad or whatever it is) to sql server.
I have seen a few examples for doing it with mysql and oracle, but not sql server, specific product information is sometimes challenging to find.
Any help would be greatly appreciated.
Thanks. Mike

Azure: Intra-WebRole Communication (netTcpBinding) with Full-IIS

I need to change some configuration settings on-the-fly in a Windows Azure project - and they need to be changed via a web service call (updating the application's configuration either via the platform api or the Azure Management site isn't an option here).
The project has multiple web and worker roles - all of which will need to know about the new configuration when it is changed.
The configuration is persisted to durable storage, and it's also cached during runtime in a static variable.
My solution was to create an internal (tcp) endpoint on my roles, and use that to loop through all of the roles and instances within those roles, create a client on the fly, and tell the instance about the new setting. (pretty much identical to: http://msdn.microsoft.com/en-us/gg457891)
At first I started a ServiceHost in the WebRole's RoleEntryPoint... and I was confused why everything seemed to be working fine when I stepped through the communications (the static variables where getting set correctly) - yet when I'd make other webservice calls, the static variable seemed to have "forgotten" what I set it to.
This was the case both locally, and in the Azure staging environment.
At this point I realized that because we're using full-IIS mode, the RoleEntryPoint and the Web Services were running in two separate processes - one in Azure's stub, and one in IIS.
"Not a problem" I said, I'll simply move the line of code which starts the ServiceHost from my RoleEntryPoint into the global.asax - at which point the ServiceHost will have been started in the same process as the rest of the site - and the static variables would be the same ones.
Here's where I'm having a problem; This works great on my local machine running in the dev environment. As soon as I deploy to staging I start getting error emails saying the channel used to connect to the service can't be closed because it's in a "faulted state".
Question:
What's different about Azure vs. Dev environment that is causing this?
How can I fix or workaround the problem?
Does anyone have any general advice on how I should go about obtaining a more descriptive error... do I have to enable full wcf diagnostics in Azure to get this, or is there some other way I can get at the exception details?
Follow-Up:
Via remote desktop i've learned several interesting things:
Non-HTTP Activation isn't installed by default on Azure WebRoles. I believe this can be overcome via a startup script:
start /w pkgmgr /iu:WCF-NonHTTP-Activation;
The website created in IIS by the web role doesn't have the net.tcp protocol enabled by default. I also believe this can be overcome with a startup script:
%systemroot%\system32\inetsrv\appcmd.exe set app "Website Name Here" /enabledProtocols:https,http,net.tcp
I haven't had time to take this all the way, as deadlines have forced me to implement some workarounds temporarily.
Some useful links related to this topic:
http://msdn.microsoft.com/en-us/magazine/cc163357.aspx
http://forums.iis.net/t/1160443.aspx
http://msdn.microsoft.com/en-us/library/ms731053.aspx
http://labs.episerver.com/en/Blogs/Paul-Smith/Dates/2008/6/Hosting-non-HTTP-based-WCF-applications-in-IIS7/
UPDATE (6/27/2011):
Amazingly, someone at Microsoft (whose blog I commented on) actually got me an answer on this.
The Azure & WCF teams updated this post:
http://blogs.msdn.com/b/windowsazure/archive/2011/06/27/hosting-services-with-was-and-iis-on-windows-azure.aspx
The link contains all of the information you need to get going with this.
And a HUGE thanks goes to Yavor Georgiev, the MSFT PM with the win.
It's been quite a while since I've asked the question, and no answers, so let me leave this:
Per my follow-ups in the post, there are ways of making this work... but they are complicated and difficult to implement.
For WORKER ROLES, netTcpBinding works perfectly. No issues here. Go ahead and use it.
For WEB ROLES, you've got problems.But netTcpBinding is what you need to use for exposing internal endpoints. What to do?
Well, here's what I did:
Start netTcpBinding service in your RoleEntryPoint using ServiceHost.
Create standard WCF service in your web role using SOAP / JSON / Whatever you want.
When you receive requests through your netTcpBinding, proxy them along to the WCF service on the loopback adapter.
Properly secure your "internal" WCF service with SSL client certs.
It's not perfect... but it works, and it's not terrible.
I suspect that needing to do this kind of thing isn't super common, and I really can't think of any reason why you'd need to other than to dynamically modify settings at runtime... which means you're not slamming these services like crazy.
Obviously, YMMV.
I had a miserable time getting HTTP working between instances in staging, and gave up when it looked like I needed to mess around with netsh to give my processes permission to listen via an HttpListener (sheesh!). So I switched to TCP via sockets. HTTP just adds overhead in a point-to-point communication scenario like this.

Categories

Resources