我与Cassandra合作并尝试连接Cassandra中的数据库,但是收到错误,例如" System.FormatException' occurred in Cassandra.dll but was not handled in user code
"和Contact Points value are missing in the connection string
的附加信息。你能看一下我的连接代码,如下所示
的HomeController
public class HomeController : Controller
{
//CqlConnection cqlConnection = new CqlConnection();
private string conString = ConfigurationManager.ConnectionStrings["CassandraConnString"].ToString();
// GET: Home
public ActionResult Index()
{
using (CqlConnection cqlConnection = new CqlConnection(conString))
{
cqlConnection.Open();
}
return View();
}
}
WebConfig
<connectionStrings>
<add name="CassandraConnString" connectionString="Database=StudentMaster;Port=9042;Server=127.0.0.1;"/>
</connectionStrings>
请您解决连接问题,请告诉我您的想法。
答案 0 :(得分:2)
您的连接字符串应类似于:
Contact Points=127.0.0.1;Default Keyspace=StudentMaster
您可以在此处检查可用的连接字符串元素: https://github.com/datastax/csharp-driver/blob/master/src/Cassandra/CassandraConnectionStringBuilder.cs