1
votes
I am using Silverlight application. From this I have called  QuickBooks using QBFC12. Based on my request I got the data and pushed into my own application. Everything fine.

But when I deploy my project in iis …I am not able to connect to quick books. Whenever I connect to quick books I am getting message: Could not start quick books.

I am stuck here. I do not know where to start? Someone asked me to start with webconnector. If I use webconnector I have to create .qwc file. And I have to pass

1.AppURL

2.UserName

3.PassWord ..etc.

This is other user interface…but I don’t want use any other applications…like webconnector.

But my requirement is :

Using my asp.net application I have to give the to select to the end user: like

1.Customers

2.vendors

3.items like check boxes.

Based on the selection i have to get the related data .

Can any one Please suggestion me how can i connect quick books from deployment area.....

Or any other solutions.....

1

1 Answers

0
votes

In case someone else has run into this same issue. You can't run it directly from ASP.NET. QuickBooks was not designed to be run from a Service. I have however found a sort of hybrid solution. Using a console application and a self hosted WCF Restful Service. You can open a connection to Quickbooks, begin a session, and store that in a static/shared variable. To use the connection you'll have to store your data access methods in a task and pass the task to a thread safe collection that the main thread can poll. This seems to get passed the notable Could not connect to Quickbooks error message and thread hanging.

I recommend using the ConcurrentQueue(Of Task(Of Object))

Example Service Endpoint Call:

Dim tsk As New Task(Of Object)(Function() Quickbooks.createVendor(collectionOfVendors))
Queue.Enqueue(tsk)
Dim result = Await tsk ' Wait for your task to complete here

Main:

waitAgain: ' Await queue to fill Do Until Queue.Count > 0 'Wait for queue request Loop
' Process queue Dim proc = Task.Run(Function() ProcessQueue()) proc.Wait()
GoTo waitAgain

ProcessQueue:

Dim activeTsks As New List(Of Task(Of Object)) For i = 0 To Queue.Count - 1 Dim target As Task(Of Object) = Nothing If Queue.TryDequeue(target) AndAlso target.IsntNothing AndAlso target.Status = TaskStatus.Created Then
activeTsks.Add(target) target.Start() End If
Next
' Wait for all in the queue to process Await Task.WhenAll(activeTsks)

Exception handling can be tricky but if you catch in the right places you can propagate the exception to the endpoint method and respond properly. QuickBooks isn't necessarily designed for this type of usage so one other caveat is that QuickBooks will hang until it is done completing a request from a

IMsgSetRequest

I will put together a github repository soon.