AggregateException on Cluster.OpenBucket method in Couchbase - c#

I am trying out Couchbase database, I've followed the tutorial here:
http://developer.couchbase.com/documentation/server/4.0/sdks/dotnet-2.2/hello-couchbase.html
I've installed the nugget from Package manager, and started to code. But as I am trying to call Cluster.OpenBucket function I am getting :
An unhandled exception of type 'System.AggregateException' occurred in Couchbase.NetClient.dll
"A connection attempt failed because the connected party did not
properly respond after a period of time, or established connection
failed because connected host has failed to respond"
That's my code:
class DbMgr
{
private static readonly Cluster Cluster = new Cluster();
const string BUCKET_NAME = "This-Is-A-Bucket-Name";
public void Init()
{
//This is where I get exception....
using (var bucket = Cluster.OpenBucket(BUCKET_NAME, ""))
{
var document = new Document<dynamic>
{
Id = "Hello",
Content = new
{
name = "Couchbase"
}
};
}
}
}
Any Ideas?

Related

How to fix System.ArgumentNullException when deploying Remote actor on Local Host

I am new to Akka.Net and tried to follow a simple procedure from "Remotely Deploying Actors" tutorial on the getakka.net site.
I however get a System.ArgumentNullException which says 'Value cannot be null. (Parameter 'typeName')'.
Here's my server actor creation block:
var thishocon = HoconLeader.FromFile("akka.net.hocon");
ActorSystem myactorSystem = ActorSystem.Create("server-system", thishocon);
And my akka.net.hocon file for the (console) server:
akka {
actor {
provider = "Akka.Remote.RemoteActorRefProvider, Akka.Remote"
# provider = remote
serializers {
hyperion = "Akka.Serialization.HyperionSerializer,
Akka.Serialization.Hyperion"
}
}
remote {
dot-netty.tcp {
# helios.tcp {
port = 8081 # bound to a specific port
hostname = localhost
}
}
}
The error shows up on the line where I try to reference the remote actor system on the asp.net core client:
Config myhocon = HoconLeader.FromFile("akka.net.hocon");
var actorSystem = ActorSystem.Create("aspnet-actor-system", myhocon);
And here's my akka.net.hocon for the asp.net core client:
akka {
actor {
provider "Akka.Remote.RemoteActorRefProvider, Akka.Remote"
# provider = remote
deployment {
/calculator {
remote = "akka.tcp://server-system#localhost:8081"
}
}
serializers {
hyperion = "Akka.Serialization.HyperionSerializer,
Akka.Serialization.Hyperion"
}
}
remote {
dot-netty.tcp {
# helios.tcp {
port = 0 # bound to a dynamic port assigned by the OS
hostname = localhost
}
}
}
The FromFile method simply creates a config from the specified text document:
public static Config FromFile (string path)
{
var hoconContent = System.IO.File.ReadAllText(path);
return ConfigurationFactory.ParseString(hoconContent);
}
I have set visual studio to start the server before the client of course. The server does start listening on the desired port but then the error happens:
Could this be a firewall issue or what?

Can't Produce To Kafka When Offline

I'm trying to produce to kafka using c# and confluent.
This code works just fine when I'm connected To Internet:
ProducerConfig _config = new ProducerConfig();
_config.BootstrapServers = "127.0.0.1:9092";
using (var producer = new ProducerBuilder<Null, string>(_config).Build())
{
await producer.ProduceAsync("NewTopic", new Message<Null, string> { Value = "NewTopic" });
producer.Flush(TimeSpan.FromSeconds(10));
Console.WriteLine("Message Send!");
Console.ReadLine();
}
But When I'm Offline I Get This Error: %3|1639785660.784|FAIL|rdkafka#producer-1| [thrd:localhost:9092/0]: localhost:9092/0: Failed to resolve 'localhost:9092': The requested name is valid, but no data of the requested type was found. (after 4ms in state CONNECT)
Does Anyone Knows Why?

Unable to create Hotspot connection using NEHotspotConfigurationManager

when I try to create a hotspot connection in my Xamarin.IOS project I get the following error returned in the description when using NEHotspotConfigurationManager :
Error Domain=NEHotspotConfigurationErrorDomain Code=8 \"internal error.\" UserInfo={NSLocalizedDescription=internal error.}
I have tried to connect to both the network in the office and my phone's wifi hotspot and both return the same message. I have enabled both the options "Accept WiFi Information" and "Hotspot" on both the App ID on the developer portal and also the same in the Entitlements.plist and still the same error. I'm using the code shown below.
public async void JoinNetwork()
{
NEHotspotConfiguration config = new NEHotspotConfiguration("CTIP");
config.JoinOnce = false;
var tcs = new TaskCompletionSource<NSError>();
NEHotspotConfigurationManager.SharedManager.ApplyConfiguration(config, err => tcs.SetResult(err));
var error = await tcs.Task;
if (error != null)
{
PAGE.IOSErrorAlert(error.Description, this);
return;
}
}
Try you code as below
NEHotspotConfiguration config = new NEHotspotConfiguration("CTIP" ,passphrase , false);
config.JoinOnce = true;
var tcs = new TaskCompletionSource<NSError>();
NEHotspotConfigurationManager.SharedManager.ApplyConfiguration(config, err =>
tcs.SetResult(err));
and try to restart your device ,this seems like a known issue on apple side .
Refer to
https://stackoverflow.com/a/47769497/8187800
https://developer.apple.com/forums/thread/107851

Exception raised while inserting values into Azure COSMOS DB for MongDB API : Document does not contain shard key

I have created a database in Azure: Azure Cosmos DB.
While creating the db, I have selected the Resource Group, given Account Name, API : selected `Azure COSMOS DB for MongDB API and given rest of the required details and created the DB account.
Once the DB account is created , I have added a a DB abc-test in it and added a collection abc-test-col. While creating the collection I have given shard key as id.
Now I have created a console application to test the connectivity and write some value into the database.This is the code I have written.
class Program
{
static void Main(string[] args)
{
try
{
Console.WriteLine("Start Execution");
Program p = new Program();
IMongoCollection<CollectionData> collection = p.GetCollection();
CollectionData cd = new CollectionData();
cd.id = Guid.NewGuid().ToString();
cd.Value = 100;
Task insertjob = collection.InsertOneAsync(cd);
insertjob.Wait(); // exception raised here
Console.WriteLine("Inserted data");
Console.ReadLine();
}
catch(Exception ex)
{
Console.WriteLine("Exception : " + ex.Message);
}
}
private IMongoCollection<CollectionData> GetCollection()
{
try
{
string mongDBName = "abc-test";
IMongoDatabase database;
string collectionName = "abc-test-col";
string connectionString = "Connection String"; // Copied the primary connection string.
MongoClientSettings settings = MongoClientSettings.FromUrl(
new MongoUrl(connectionString)
);
settings.SslSettings =
new SslSettings() { EnabledSslProtocols = SslProtocols.Tls12 };
var mongoClient = new MongoClient(settings);
database = mongoClient.GetDatabase(mongDBName);
return database.GetCollection<CollectionData>(collectionName);
}
catch (Exception ex)
{
throw;
}
}
}
When I run this , I'm getting an exception
One or more errors occurred. (Command insert failed: document does not
contain shard key.)
I have added id in my CollectionData, but still it is giving this exception.
Any help as to why this is throwing this error.Am I missing something
Any help in this matter will be so helpful.

Project Server 2010 - ApproveNonProjectTime method GeneralItemDoesNotExist error

I try to approve non project time in a console application with the ApproveNonProjectTime method (http://msdn.microsoft.com/en-us/library/websvctimesheet.timesheet.approvenonprojecttime%28v=office.12%29.aspx).
My code is very simple :
class Program
{
const string projectServerUri = "http://morpheus-sp/pwa/";
const string resourceServicePath = "_vti_bin/psi/Timesheet.asmx";
static void Main(string[] args)
{
TimesheetWebSvc.TimeSheet timesheetSvc = new TimesheetWebSvc.TimeSheet();
timesheetSvc.Url = projectServerUri + resourceServicePath;
timesheetSvc.Credentials = CredentialCache.DefaultCredentials;
timesheetSvc.ApproveNonProjectTime(new Guid[] { new Guid("D6909043-18A7-4FF6-83BB-67EFDF17A279")}, null);
}
}
When I execute it I have this error message :
System.Web.Services.Protocols.SoapException: ProjectServerError(s) LastError=GeneralItemDoesNotExis
However I took the TS_LINE_UID directly in my DB and its status is Pending Approval.
Have you a solution ?
Thank you,
Justin

Categories

Resources