New Login method times out

Using the new method for logging in times out without indicating the reason:

if(AvontusPrincipal.Login(AvontusUserName, AvontusUserPassword)) { ... }

Hello. Few things to try.

Can you confirm that you’ve removed the AvontusPrincipal.LoadPrincipal() method?

Also, we’ve updated Avontus.Core.dll ( If you grab the build we posted a few days ago it has the new one. Can you ensure you’re pointing to the correct binaries?

.NET version should be set to version 4.

The complete code is as follows:

    static IEnumerable<ScaffoldTag> GetTagsByJobId(Guid jobId) {
        if (AvontusPrincipal.Login("TheUserName", "ThePassword")) { //Reference:
            var jobs = StockingLocationList.GetScaffoldTagJobs(false, Guid.Empty, false);
            var matchingJob = (from job in jobs where job.StockingLocationID == jobId select job).FirstOrDefault();
            if (matchingJob == null) {
                throw new HttpResponseException(HttpStatusCode.NotFound);
            var tags = ScaffoldTagList.GetScaffoldTagList(new List<Guid> { matchingJob.StockingLocationID }, false);
            return tags.Count == 0
                ? new Collection<ScaffoldTag>()
                : from tag in tags select ScaffoldTag.GetScaffoldTag(tag.ScaffoldTagID);
        } return null;

.NET version = 4.5.1
Avontus.Core.dll version =

It eventually times out with the following exception:

“DataPortal.Fetch failed (A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server))”

I have confirmed that I can connect to the SQL Server (that hasn’t changed from version 6) using the credentials provided in the dataconnection.

Server=;MultipleActiveResultSets=True;Database=ASIRentalManager;User ID=ASIUser;Password=

That’s odd. Can you install Quantify on this machine and verify that you can connect?

Installing Quantify is not an option (and, honestly, a poor solution).

Actually… on thinking about it a bit further… I think your connection string is incorrect. While that is technically a correct connection string as far as SQL Server goes, Quantify does require the use of the old format. i.e. this does not work:

Server=…;Database=…; etc… 

It needs to be:

Data Source=<server name>;Initial Catalog=<database name>;MultipleActiveResultSets=True;User ID=ASIUser;Password=<password>

Otherwise you will get a connection timeout.

No go. setting that in the web.config continues to fail


Here’s another thing you can try:

Add this to your section in your web.config:

<add key="ApplicationUri" value="some value"/>

This may sound strange, but I think this may work around your issue. (The value could be anything… the appSetting just needs to be present.) Let me know if this fixes it for you–if it does I’ll log a bug against it.

By the way… you’ll still ned to use “Data Source” and “Initial Catalog” in your connection string.

With adding this it no longer times out, it fails quickly with the following exception:


“DataPortal.Fetch failed (Object reference not set to an instance of an object.)”

Could you post the complete stack trace?

at Avontus.Rental.Library.Database.CommonDatabase.get_DatabaseConnection()
at Avontus.Rental.Library.Security.AvontusUser.DataPortal_Fetch(LoginCriteria criteria)
at dm(Object , Object[] )
at Avontus.Core.Reflection.MethodCaller.CallMethod(Object obj, DynamicMethodHandle methodHandle, Object[] parameters)
at Avontus.Core.Reflection.MethodCaller.CallMethod(Object obj, DynamicMethodHandle methodHandle, Object[] parameters)
at Avontus.Core.Reflection.MethodCaller.CallMethod(Object obj, String method, Object[] parameters)
at Avontus.Core.Reflection.LateBoundObject.CallMethod(String method, Object[] parameters)
at Avontus.Core.Server.SimpleDataPortal.Fetch(Type objectType, Object criteria, DataPortalContext context)
at Avontus.Core.DataPortal.Fetch(Type objectType, Object criteria)
at Avontus.Core.DataPortal.Fetch[T](Object criteria)
at Avontus.Rental.Library.Security.AvontusUser.GetUser(String username, String password)
at Avontus.Rental.Library.Security.AvontusPrincipal.Login(String username, String password)
at PD.Avontus.WebApi.Controllers.JobsApiController.GetTagsByJobId(Guid jobId) in d:\dev\PD.Avontus.Integration\source\application\PD.Avontus.WebApi\Controllers\JobsApiController.cs:line 114

Ok, so, the name of the connection string in your web.config is “ASIRentalMgrDB” is it not? You will get an exception if it is not present or present under a different name.

We have a winner! I am pretty certain that it used to work if the database connection string was called “dataConnection”

I spoke too soon. That is working in my integration tests but not in the service when run in isolation.
I have those settings in my web.config but it appears as though it’s still timing out when run in my web service.

This has cost me 3 days of development time trying to get up and working for a production application. Would it be possible to get someone familiar with this to call me and help me resolve this issue?

I believe support has your contact information from previously… Will let you know if we can’t locate it.

Thank you for your help. :grinning: