mongo-csharp-driver 2.0 / nservicebus.mongodb 2.1 can no longer connect to Mongo - mongodb

We recently updated our NserviceBus.MongoDb package from 2.0.3 to 2.1. This also updated the mongo-csharp-driver package from 1.10 to 2.0.1. We now see the following exception when the service starts:
2015-07-08 11:29:16,589 [1] WARN NServiceBus.MongoDB.Internals.MongoHelpers [(null)] <(null)> - Mongo could not be contacted using: server201.localco.test:27017.
If you are using a Replica Set, please ensure that all the Mongo instance(s) server201.localco.test:27017 are available.
To configure NServiceBus to use a different connection string add a connection string named "NServiceBus/Persistence" in your config file.
Reason: System.InvalidOperationException: There is no current primary.
at MongoDB.Driver.MongoServer.Ping()
at NServiceBus.MongoDB.Internals.MongoHelpers.VerifyConnectionToMongoServer(MongoClientAccessor mongoClientAccessor) in d:\Development\NServiceBus.MongoDB\src\NServiceBus.MongoDB\Internals\MongoHelpers.cs:line 50
The only relevant line in our nservicebus endpoint config is:
configuration.UsePersistence<MongoDBPersistence>();
and our connection string is:
<add name="NServiceBus.Persistence" connectionString="mongodb://server201.localco.test/?replicaSet=rs0" />
If I uninstall/rollback 2.1/2.0.1 to 2.0.3/1.10 (nservicebus.mongodb/mongo-csharp-driver) the error goes away.
Update: I see that the database itself (with a TimoutData collection) is actually created in Mongo...

Change your connection string from
<add name="NServiceBus.Persistence" connectionString="mongodb://server201.localco.test/?replicaSet=rs0" />
to
<add name="NServiceBus/Persistence/MongoDB" connectionString="mongodb://server201.localco.test/?replicaSet=rs0" />
or leave it like above and set the name to
config
.UsePersistence<MongoDbPersistence>()
.SetConnectionStringName("NServiceBus.Persistence");

Latest version of the package from Github/Nuget has addressed this issue. See bug report

Related

How can I add to the mongodb connection string in Mule

I want to add --sslAllowInvalidHostnames criteria to the mongo connection in Mule but cannot see how I can add this and only see a tick box for SSL.
How can I add this?
Mongo configuration:
<mongo:config name="Mongo_DB__Configuration" username="${mongodb.username}" password="${mongodb.password}" database="${mongodb.database}" host="${mongodb.host}" doc:name="Mongo DB: Configuration"/>
Thanks
The class org.mule.modules.mongo.Config (in version 4.1.0, can't confirm for others) simply checks for a system property called sslInvalidHostNameAllowed and sets the criteria accordingly.
Try adding -DsslInvalidHostNameAllowed=true to your java command used to launch Mule, or alternatively by adding wrapper.java.additional.<n>=-DsslInvalidHostNameAllowed=true to your wrapper.conf file (in MULE_HOME/conf) for standalone Mule instances.

Restcomm - Solving SMSC GW 7.2 configuration failures

We configured the latest version (7.2) SMSC-GW to work on on our server with the environment (cassandra and such). However, after setting up everything. Some failures are appearing (which did not appear in previous versions).
Firstly, when connecting the simulators and the gateway using the default settings (JSS7 <-> SMSCGW <-> SMPP)
JSS7 is connected and sending, but no response is received.
SMPP is connected to SMSC-GW and the EMSE is bound. SMPP tries to send to SS7 but receives a response PDU packet failure from the SMSC-GW
I tried configuring DB routing rules, but that did not work.
Also, the log in the SMSC-GW server is frequently displaying the following message:
16:00:28,504 INFO [SchedulerResourceAdaptor] (pool-56-thread-1) Not all SBB are running now: ServicesDownList=[smscTxSmppServerServiceState, smscRxSmppServerServiceState, smscTxSipServerServiceState, smscRxSipServerServiceState, smscTxHttpServerServiceState, moServiceState, homeRoutingServiceState, mtServiceState, alertServiceState, chargingServiceState, ]
And the JSS7 management console GUI is displaying this (which looks wrong):
So are these the source of the SMSC-GW failures?
UPDATE: I found this error in the server.log
2017-02-02 10:57:42,005 WARN [org.mobicents.slee.container.deployment.jboss.SleeContainerDeployerImpl] (SLEE-InternalDeployer-thread-1) SLEE DUs not deployed, due to missing dependencies: file:/home/coreteam/kitchensink/restcomm-smsc-7.2.109/jboss-5.1.0.GA/server/simulator/deploy/smsc-services-du-7.2.109.jar/
Followed by:
EventTypeID[name=org.mobicents.smsc.slee.services.smpp.server.events.SS7_SEND_MT,vendor=org.mobicents,version=1.0]
ResourceAdaptorTypeID[name=PersistenceResourceAdaptorType,vendor=org.mobicents,version=1.0]
ResourceAdaptorTypeID[name=SchedulerResourceAdaptorType,vendor=org.mobicents,version=1.0]
SipRA
EventTypeID[name=org.mobicents.smsc.slee.services.smpp.server.events.SS7_SEND_RSDS,vendor=org.mobicents,version=1.0]
SchedulerResourceAdaptor^M
PersistenceResourceAdaptor^M
EventTypeID[name=org.mobicents.smsc.slee.services.smpp.server.events.SMPP_SM,vendor=org.mobicents,version=1.0]
EventTypeID[name=org.mobicents.smsc.slee.services.smpp.server.events.SS7_SM,vendor=org.mobicents,version=1.0]
EventTypeID[name=org.mobicents.smsc.slee.services.smpp.server.events.SIP_SM,vendor=org.mobicents,version=1.0]
2017-02-02 14:41:17,450 WARN [org.mobicents.slee.container.deployment.jboss.DeploymentManager] (main) Unable to INSTALL smsc-services-du-7.3.0-SNAPSHOT.jar right now. Waiting for dependencies to be resolved.
Solved it quite a while ago, but thought I would share. I just simply installed the SipRA missing dependency by adding the following in the deploy-config.xml file:
<ra-entity
resource-adaptor-id="ResourceAdaptorID[name=JainSipResourceAdaptor,vendor=net.java.slee.sip,version=1.2]"
entity-name="SipRA">
<properties>
<property name="javax.sip.PORT" type="java.lang.Integer" value="5060" />
</properties>
<ra-link name="SipRA" />
In the $JBOSS_HOME/server/profile_name/deploy/restcomm-slee directory.
I set the port to some other value since that number was already taken by some other service.
The smsc-services-du-7.2.109.jar then installed automatically the next time I ran the SMSC-GW.

connectionString in Entity Framework

I am stuck. I have spent nearly a day to solve but to no avail.
PROBLEM: Connecting to production database using entity framework.
I connect fine on development.
<add name="DefaultConnectionString" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=MONDO;Integrated Security=True" providerName="System.Data.SqlClient" />
<add name="MONDOEntities" connectionString="metadata=res://*;provider=System.Data.SqlClient;provider connection string="Data Source=.\SQLEXPRESS;Initial Catalog=MONDO;Integrated Security=True;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" />
Moving to production, I used (from the production web.config file) the existing "DefaultConnectionString" parameters (ID and Password) to edit the MONDOEntities connectionString. (can I do this?) Also, I expanded the metadata in MONDOEntities to include .csdl, .ssdl, .msl and I prefixed it with (guessing, again, can I do this?) MONDO. Bold parts are changes from dev web.config to production web.config. *Note, the connectionStrings below were not created by Visual Studio, I just changed some info myself to try and make it work on the production side.
<add connectionString="Data Source=MPOC\SQLEXPRESS;Database=Mondo;User ID=xxx;Password=xxxxx;" name="DefaultConnectionString" />
<add name="MONDOEntities" connectionString="metadata=res://*/MONDO.csdl|res://*/MONDO.ssdl|res://*/MONDO.msl;provider=System.Data.SqlClient;provider connection string="Data Source=MPOC\SQLEXPRESS;persist security info=True;Database=Mondo;User ID=xxx;Password=xxxxx;MultipleActiveResultSets=Tru e;App=EntityFramework"" providerName="System.Data.EntityClient" />
The error message I get is:
Unable to load the specified metadata resource.
Line 62: /// Initializes a new MONDOEntities object using the connection string found in the 'MONDOEntities' section of the application configuration file.
Line 63: /// </summary>
Line 64: public MONDOEntities() :
QUESTION: Can I simply modify the connectionStrings manually or does it need to run through a compilation process? It is a website project so it compiles, on the fly, the first time after I upload to production. It does not get precompiled on my local dev computer. I guess, bottom line, how do I set up a proper connectionString for an entity connection for a database in production?
I'm on a project where I need to learn an existing website. I'm making my first bug fix and having learned ado.net, I created an entity data model and made some code changes. Everything works smooth in development.
I move the files to production and then I get this error:
"The specified default EntityContainer name 'MONDOEntities' could not be found in the mapping and metadata information.
Parameter name: defaultContainerName"
I googled this error message and based on some findings, I expanded my "metadata" shown below. This was more of a shot in dark for me:
ORIGINAL (auto generated in web.config when I created the entity data model):
connectionString="metadata=res://*
NEW (I edited/added this):
connectionString="metadata=res://*/MONDO.csdl|res://*/MONDO.ssdl|res://*/MONDO.msl;
This seemed to get past the first error and I get to a new error message (as posted in OP):
Unable to load the specified metadata resource.
Line 62: /// Initializes a new MONDOEntities object using the connection string found in the 'MONDOEntities' section of the application configuration file.
Line 63: /// </summary>
Line 64: public MONDOEntities() :
I think that there is a problem with my metadata information. However, given that the original, auto generated connectString only contains "metadata=res://*", I really don't know how to go about correcting this. Actually, I'm not even super sure that this is the root of the problem.
Bottom line, my entity model works smooth in dev but isn't connecting in production. Any thoughts are appreciated ... thanks.
The connection string has nothing to do with compilation, as long as you didn't define some transformation to be performed on it or you have some custom hooks that operate on it.
So yeah, you can modify it by hand.
You probably got those metadata wrong, try and play with them (EG removing the prefix).
Also are you absolutely sure that, in your production environment, the right connectionString is being loaded and used by the MONDOEntities?

CruiseControl.NET no connection can be made?

I am setting up CruiseControl.NET and I get the following error message on the webdashboard:
No connection could be made because the target machine actively refused it 127.0.0.1:21234
The Url it is looking for is: tcp://localhost:21234/CruiseManager.rem
However the ccnet website in IIS has its tcp port set to 82.
So I use the following Url to navigate to the webdashboard http://127.0.0.1:82/ccnet/ViewFarmReport.aspx
I tried changing the Tcp port in IIS to 21234 and I get the following error message on the webdashboard:
Tcp channel protocol violation: expecting preamble.
I have also tried opening the port with the following command:
netsh firewall add portopening TCP 21234 CCNET
When I try and start the CCNET service I get the following message
The CruiseControl.NET Server service started then stopped. Some services stop automatically if they have no work to do....
Can anyone help me with this problem please?
EDIT - Adding config file
<cruisecontrol xmlns:cb="urn:ccnet.config.builder">
<cb:define PublishDir="C:\Deploy\Portal2.0Build"/>
<project name="Portal2.0">
<workingDirectory>C:\PortalCruiseControl\Working</workingDirectory>
<artifactDirectory>C:\PortalCruiseControl\Artifacts</artifactDirectory>
<webURL>http://192.168.17.59:82/ccnet</webURL>
<triggers>
<intervalTrigger name="continuous" seconds="10"
buildCondition="IfModificationExists"/>
</triggers>
<sourcecontrol type="svn">
<trunkUrl>https://portal2003.local:8443/svn/portalv2.0/trunk</trunkUrl>
<executable>C:\Program Files (x86)\VisualSVN Server\bin\svn.exe</executable>
<username>ccnet</username>
<password>***</password>
<cleanCopy>true</cleanCopy>
</sourcecontrol>
<tasks>
<msbuild>
<executable>
C:\WINDOWS\microsoft.net\Framework64\v3.5\MSBuild.exe
</executable>
<projectFile>Portal2.0.sln</projectFile>
<buildArgs>
/target:build;publish /p:Configuration=Release /p:MSBuildExtensionsPath=C:\Progra~2\MSBuild /p:MSBuildEmitSolution=1 /p:publishdir=C:\Deploy\Portal2.0Build /verbosity:diag
</buildArgs>
<logger>
C:\Program Files (x86)\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MSBuild.dll
</logger>
</msbuild>
</tasks>
<labeller type="assemblyVersionLabeller">
<major>2</major>
<minor>0</minor>
<incrementOnFailure>false</incrementOnFailure>
</labeller>
<publishers>
<statistics />
<xmllogger />
<package>
<name>ZipFilePublish</name>
<compression>9</compression>
<always>false</always>
<flatten>false</flatten>
<baseDirectory>$(PublishDir)</baseDirectory>
<dynamicValues>
<replacementValue property="name">
<format>C:\Deploy\Builds\PortalBuild{0}.zip</format>
<parameters>
<namedValue name="$CCNetLabel" value="Default" />
</parameters>
</replacementValue>
</dynamicValues>
<files>
<file>*.*</file>
<file>**\*</file>
</files>
</package>
<email from="bla" mailhost="bla" port="25" userName="bla"
password="bla" includeDetails="TRUE" useSSL="FALSE">
<users>
<user name="User1" group="Portal" address=""/>
</users>
<groups>
<group name="Portal">
<notifications>
<notificationType>change</notificationType>
</notifications>
</group>
</groups>
</email>
</publishers>
</project>
The first error message is probably caused by CCNET service not running because of which the web dashboard can't connect to it. It should go away as soon as you fix the ccnet.config so that service starts running.
The second problem ("Ilegal characters in path"; you seem to have already figured out the missing nodes part) is caused by msbuild/executable element. It seems that CC.NET doesn't like whitespace and especially new line characters inside it's value. Replacing:
<executable>
C:\WINDOWS\microsoft.net\Framework64\v3.5\MSBuild.exe
</executable>
with:
<executable>C:\WINDOWS\microsoft.net\Framework64\v3.5\MSBuild.exe</executable>
should fix the problem.
Another hint: when you're having problems with the validity of your ccnet.config file, try using CCValidator.exe (it's in your CruiseControl.NET\server folder). It usually points out the problematic part of the config file quite nicely (although that wasn't the case with "Illegal characters in path" problem - I had to comment out specific parts of the config to find the offending node).
The first message you receive (connection actively refused) makes me think of a firewall which is blocking the port you're using.
The second problem could be anything. It could for instance be an error in your XML configuration (ccnet.config) file. Can you find any pointers in the Windows Eventlog ?
Regarding the 2nd problem: did you try to run the CC.NET server from the command line?
If you've got an error in your XML configuration, this will give you a more meaningful error message.
Which account are you using to run the Windows service?
Have you checked your ccnet's dashboard.config file?
It has the following line in it:
<server name="local" url="tcp://localhost:21234/CruiseManager.rem" ... />
Try changing the port on that to 82 and then restarting the website (you should be just able to add a space to the web.config file and save and IIS will restart the website).
Sounds like you're confusing two different functions:
tcp://localhost:21234
This is the default remoting port for clients like CCTray. This is not used for the IIS web site (dashboard).
Configuration document is likely missing Xml nodes required for properly populating CruiseControl co nfiguration. Missing Xml node (packageList) for required member (ThoughtWorks.CruiseControl.Core.Publishers.Package Publisher.PackageList)
Your example config is missing required packageList node.
A misleading error message. The port really is 21234, not 82. I got the same errors. The fix was to start ccnet.exe from the desktop shortcut to discover that the real problem was illegal code in my ccnet.config file.
After fixing the ccnet.config file, the problem moved on. When attempting to build, the system would not let the subversion client modify the read-only marker files in the checked out repo.
In my case I misprinted project configuration file name in ccnet.config instead of timescheduler.config it were timesheduler. When I fixed file name I was able to run ccnet service.
<cruisecontrol xmlns:cb="urn:ccnet.config.builder">
<cb:include href="definitions.xml" xmlns:cb="urn:ccnet.config.builder"/>
<cb:include href="projects/timescheduler.config" xmlns:cb="urn:ccnet.config.builder"/>
</cruisecontrol>

Format of the initialization string does not conform to specification starting at index 0

I have an ASP.Net MVC application which runs fine on my local development machine. But when deployed to IIS7 gives the following error when trying to log in:
Format of the initialization string does not conform to specification
starting at index 0
Most people who post this error resolve it by changing their connection string in some way. However my connection string on the local and deployed application are the same. The connection string is like this:
<add name="ApplicationServices" connectionString="Data Source=*server*\*instance*;Initial Catalog=*database*;Integrated Security=True;"
providerName="System.Data.SqlClient" />
What is causing this error in my case?
Format of the initialization string does not conform to specification
starting at index 0
Web.config :
<connectionStrings>
<add name="TestDataConnectionString" connectionString="Data Source=.\SQLExpress;Initial Catalog=TestData;User ID=satest;Password=satest"
/>
</connectionStrings>
In aspx.cs Page the code must be written in the below format :
SqlConnection con = new
SqlConnection(ConfigurationManager.ConnectionStrings["TestDataConnectionString"].ToString());
Web Deployment tool created wrong line in config when I checked Enable CodeFirst Migrations check-box.
In my case I accidentally wrote "password:" instead of "password=" in my conn string
Check to make sure the credentials are correct for the connection string in Web.config. Mine was missing the password for the account with permissions to the database.
I encountered the same error. In my case it was the config transform not working properly.
There is an issue with config transforms when it comes to connection strings.
Some reference:
MSBuild web.config transforms not working by drneel
Replaceable token issue with config ConnectionString transforms by Francis
Also one can write the code in the aspx.cs page as
using (IDbConnection dbConnection =
new SqlConnection(ConfigurationManager.ConnectionStrings["db"].ConnectionString))
{
// TODO: Write SQL Stored Procedures or SQL Statements using Dapper
}
For those who would like to find out more about Dapper.
Hope this helps.
If you have been using the Visual Studio Publish Wizard for deployment and checked the Execute Code First Migrations check box in Settings, a new ConnectionString is automatically added to the Server Web.config file, similar t to the 2nd line below:
<add name="LCWeb3Context" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;Initial Catalog=LCWeb3;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\LCWeb3.mdf" providerName="System.Data.SqlClient" />
<add name="LCWeb3Context_DatabasePublish" connectionString="LCWeb3Context_DatabasePublish.ConnetionString" providerName="System.Data.SqlClient" />
First, notice the added connection string contains "ConnetionString": I think it should be "ConnectionString"! But that's not the solution.
To avoid the "Format of the initialization string does not conform to specification starting at index 0" error, do the following in the Publish Wizard:
In the Settings, select Configuration: Release
In the Settings,don't forget to paste your Connection String in the
"Remote Connection String" field
In the Settings, check Execute Code First Migrations
When doing the above, the connection string added to the Server Web.config reads:
<add name="LCWeb3Context_DatabasePublish" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\LCWeb3.mdf;Initial Catalog=LCWeb3;Integrated Security=True" providerName="System.Data.SqlClient" />
and the "Format of the initialization string does not conform to specification starting at index 0" error no longer occurs.
I has the same issue, when I use command: "Update-Database" in Package Manager Console.
To Fix, make sure set startup project to the project which you want to do update.
E.g. I got Db project and Web project, make sure set startup project on Db project, when run "Update-Database", otherwise, it will try to search inside Web project.
The permissions on the SQL server were not correctly set up. I have now resolved this by properly setting up the server permissions.