Sync gateway is not syncing with Couchbase server in Xamarin - c#

I am trying to use couchbase for online and offline database in my xamarin application .
the offline part is working good , but it doesn't sync .
I followed this tutorial :
https://docs.couchbase.com/userprofile-couchbase-mobile/sync/userprofile/xamarin/userprofile_sync.html
I have installed couchbase server , I created a bucket named : userprofile , and a user and I have enabled the Application Access and Read Only Admin roles.
also I installed sync gateway and I have configured it ,
here is my configuration .json file
{
"log": ["*"],
"databases": {
"userprofile": {
"server": "http://127.0.0.1:8091",
"bucket": "user-profile",
"username": "Maria",
"password": "123456",
"enable_shared_bucket_access": true,
"import_docs": true,
"num_index_replicas": 0,
"delta_sync" :{"enabled":true},
"users": {
"Maria": { "password": "123456"},
"GUEST": { "disabled": false, "admin_channels": ["*"] }
},
"sync": `function (doc, oldDoc) {
if (doc.sdk) {
channel(doc.sdk);
}
}`
}
}
}
and I used this command to configure the sync gateway :
C:\Program Files\Couchbase\Sync Gateway\sync_gateway sync-gateway-config-userprofile-walrus.json
also I have changed the sync url to ws://10.0.2.2:4984 because I am using android emulator .
but it did not sync between devices , can anyone help me please ?

1) How are you verifying if the sync is working (what steps did you follow for testing)? If you are following the instructions here, that won't work with the config you have above. Because the only valid user that you have configured in your config file is the one with credentials "username" and "password" and the steps in tutorial indicates a different username/password. So make sure you log into your app with the credentials you have in your config file and try out
2) You indicated that you have a Couchbase Server running that you have configured for Sync Gateway access. But your config file indicates that you are using "walrus" mode (Walrus mode is a memory only mode intended only for dev/test purposes). In other words, in walrus mode, you are not pointing to an actual couchbase server.
If you want to sync with a backend Couchbase Server(which you should), then replace the "walrus:" in the "server" property in the config file to point to the couchbase server.
3) The best resource to troubleshoot is the Sync Gateway logs. That should give sufficient hints as to what is going wrong with the sync. Post the errors you are seeing if any if the above tips don't work
4) Check out this tutorial for relevant background. Probably from this point

Related

Can't connect to Elasticsearch (access key & secret not being respected) when running under IIS

I'm using the ElasticClient C# class for connecting to an Elasticsearch instance hosted on AWS.
var pool = new SingleNodeConnectionPool(new Uri(Url));
var httpConnection = new AwsHttpConnection(Region);
var config = new ConnectionSettings(pool, httpConnection)
.PrettyJson()
.DisableDirectStreaming()
.DefaultTypeName(TYPE)
.DefaultIndex(INDEX);
_client = new ElasticClient(config);
For setting the access key and secret, I have a credentials file stored on my Windows computer here: C:\Users\{username}\.aws\credential. It has a "default" entry, so setting the profile name manually shouldn't be required. This is working fine when I run my ASP.NET Core web application with Launch set to Project.
However, as soon as I change to Launch: IIS...
...then the Elasticsearch connection fails. Whenever I try to execute a query, it errors:
Message=Invalid NEST response built from a unsuccessful low level
call on POST: /{url1}/{url2}/_search?pretty=true&typed_keys=true
Audit trail of this API call:
1 BadRequest: Node: https://{url1}.us-east-1.es.amazonaws.com/ Took: 00:00:00.0090414
OriginalException: System.Net.Http.HttpRequestException: A socket operation was attempted to an unreachable network --->
System.Net.Sockets.SocketException: A socket operation was attempted
to an unreachable network
The IIS website is running with an app pool set to use my Windows account. Clearly, it's ignoring the .aws credentials when running under IIS. I also tried creating profiles using the AWS Explorer Visual Studio 2017 extension, both "default" as well as a custom named one.
I tried installing the AWSSDK.Extensions.NETCore.Setup nuget package in my ASP.NET Core project, and specifying the custom named profile in appsettings.json, both like this:
"AWS": {
"Profile": "local-dev-profile",
"Region": "us-east-1"
}
And like this:
"AppSettings": {
"AWSProfileName": "local-dev-profile",
},
Neither works, I still get the same "A socket operation was attempted to an unreachable network" error. I've followed all of the AWS guides and feel like I'm doing this correctly, but it just won't work under IIS. Any help would be appreciated.
I was able to get this working, for some reason when running under IIS it doesn't pull in the access key and secret like it normally would, probably related to the magic that occurs in ASP.NET Core to run under IIS. I had to add the keys to my launchSettings.json file instead to get it to work in IIS (which gets copied as ENVIRONMENT_VARIABLES to the web.config.)
Here is what an IIS profile in launchSettings.json would look like:
"MobileApi IIS (DEV)": {
"commandName": "IIS",
"launchUrl": "{url}",
"environmentVariables": {
"AWS_SECRET_ACCESS_KEY": "{value}",
"AWS_ACCESS_KEY_ID": "{value}",
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "{url}"
},

Connect Visual Studio with remotely Cassandra server

I'm trying to connect Visual Studio C# code with a Cassandra server
The code works fine in localhost, but I want to connect code to make the change directly on the server. I found instructions to edit a cassandra.ymal file like
listen_address
or
start_rpc
or
rpc_address
Note:
I open a Firewall on a specific port like 9042
I used telnet command to test IP and port is open
I found the solution, i searched a lot, so i found this, that help me, hope it will help others.
1 ) Install Cassandra Workbench
2 ) Update .cassandraWorkbench.jsonc like below snippet
//PasswordAuthenticator
{
"name": "Cluster PasswordAuthenticator", // auth methods
"contactPoints": ["xxx.xxx.xx.x", "xxx.xxx.xx.x"], // seed_provider -> seeds from your cassandra.yml
"hosts": ["xxx.xxx.xx.x"], // your host address
"authProvider": {
"class": "PasswordAuthenticator",
"username": "abc", // host username
"password": "****" // host password
}
}

Bot framework emulator not working

I started learning bot framework last week, and i decided to start off with the default bot project that returns your input and its number of character. But unfortunately, I couldn't test the bot application in bot emulator. It can't just send my input. It displays "couldn't send" whenever I forward an input.
My endpoint url which is http://localhost:3979/api/messages/ is correctly written there.
What could be wrong? I'm just a starter in bot framework and bot building.
As I'm not aware of the exact code which you are trying to execute, I'd suggest few points to be checked again.
Checkpoints:
Make sure you are running the code in debug mode with any browser (Edge, chrome, explorer etc.) and then run in the emulator.
Configure or link the emulator with ngrok. (Though it is not required when running locally but it may resolve if the emulator is not working with firewall issues)
Please check the Microsoft App Id and Microsoft App Password are the same in emulator and Web.config file.
Try with blank Microsoft App Id and Microsoft App Password in both Web.config file and emulator.
Check if the endpoints on the browser and emulator are the same
If you are encountering other errors like 401, 405, 500 please check this article.
In case if all the check points are right and you are still encountering an issue while running the code in emulator, there might be an issue with the code or reference libraries. You can also check the working example.
Check your visual studio .bot file. It should be like this.......
{
"name": "EmulatorBot",
"description": "",
"services": [
{
"type": "endpoint",[enter image description here][1]
"endpoint": "http://localhost:3978/api/messages",
"name": "EmulatorBot20181123022900",
"id": "25"
}
],
"padlock": "",
"version": "2.0",
"path": "C:\\Users\\suraj.tiwari\\Desktop\\Bot NK\\EmulatorBot\\EmulatorBot.bot",
"overrides": null
}
Add an Endpoint for your bot
Endpoint url : http://localhost:3978/api/messages
Name : EmulatorBot20181123022900

How to create a database in Azure?

I'm creating a web-app following the next guide. I need to have a sql database hosted in Azure portal. In Aure hosting settings I choose existing sql server (with no database) then choose to create new database. But when I create new ASP.NET MVC project but failed. Azure portal says
Tracking Id: 73aabcd6-7cdc-4bf5-9590-a55eb0cfe279
Status: Conflict
Provisioning State: Failed
Timestamp: 4/24/2016, 12:36:23 PM
Duration: PT32.4858855S
Type: Microsoft.Sql/servers/databases
Resource Id: /subscriptions/a56b3a76-22b0-4d67-a3dd-f726672d2b2f/resourceGroups/Isolenta29ResourceGroup/providers/Microsoft.Sql/servers/isolenta29dbserver/databases/Isolenta29Database
StatusMessage: {
"status": "Failed",
"error": {
"code": "ResourceDeploymentFailure",
"message": "The resource operation completed with terminal provisioning state 'Failed'.",
"details": [
{
"code": "40827",
"message": "The operation is not supported for your subscription offer type."
}
]
}
}
Resource: isolenta29dbserver/Isolenta29Database
I have a DreamSpark Subscription and already know it provides only one free Database. So what went wrong? How to create a databas ehosted in Azure and use it in web apps?
Looks like Dreamspark already have the support of SQL DB (however, not long ago there was no such support), but i suspect that it can be some kind of intermittent problem. You should be able to use MySQL. That is the tutorial.
as states in the error message
"message": "The operation is not supported for your subscription offer type."
seems like your DreamSpark subscription is not allowed to create any SQL database.
either you upgrade your subscription or try to use file base database that can site together with your site.

Custom activity failed in Azure Data Factory after running several hours

I was running custom .Net activity in Azure Data Factory using On-demand HDInsight cluster. Activity processes XML files, stored in Azure Blob, and move them to Azure Data Lake Store. It failed after 28 hours of execution with the following error:
"Error in Activity: The request was aborted: The request was
canceled.."
There were no log files available for this activity run and above error is not good enough to troubleshoot the problem. How can I troubleshoot this problem?
I suggest you check the system log. Even if you didn't have any user log, you shall have a system log which will help you investigate your issue.
You should be able to check system log from detail of failed output dataset(see below)
When you create a linkedServce for ondemand HDInsight, you are supposed to specify "linkedServiceName" in typeProperties
{
"$schema": "http://datafactories.schema.management.azure.com/schemas/2015-08-01/Microsoft.DataFactory.LinkedService.json",
"name": "LinkedServiceOnDemand_OnCloud_HDInsight",
"properties": {
"type": "HDInsightOnDemand",
"typeProperties": {
"clusterSize": 1,
"timeToLive": "00:10:00",
"linkedServiceName": "LinkedService_OnCloud_Storage"
}
}
}
Logs will be created in that storage. If it hadn't been created, the only option left would be getting a technical support from Microsoft.

Categories