This project is read-only.

DSA - Problems with the RequestManager

Sep 19, 2007 at 9:58 AM
Edited Sep 19, 2007 at 12:29 PM
Hello Everyone,

I got problems with the RequestQueue or more specifically with the RequestManager.
First I tried to create a new Agent:

//Described in "How to: Consume a Disconnected Service Agent"
DSA.Service1.Agent service = new Agent(RequestManager.Instance.RequestQueue);

Then he throws a NullReferenceException because RequestQueue is null.
After that I tried it like that:

RequestManager requestManager = DatabaseRequestManagerIntializer.Initialize();

DSA.Service1.Agent service = new Agent(requestManager.RequestQueue);

But now he throws a NullReferenceException becuase the requestManager is null. Details: Object reference not set to an instance of an object. The error occurred in the line with ..requestManager = Database..
Then I tried to create the RequestManager before I initialize him:

requestManager = new RequestManager();

But that didnt work(Singleton-Pattern?).

What do I have to do?


Sep 20, 2007 at 5:24 AM
Have you added the database file to the project and database configuration information in your application configuration file?

app.config file should have some entry similar to this:
<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data" />
<add name="QueueDatabase" connectionString="DataSource=Requests.sdf" providerName="System.Data.SqlServerCe" />
<dataConfiguration defaultDatabase="QueueDatabase">
<add databaseType="Microsoft.Practices.SmartClient.EnterpriseLibrary.SmartClientDatabase, Microsoft.Practices.SmartClient.EnterpriseLibrary" name="System.Data.SqlServerCe" />

If you follow this configuration you have to have a database "Requests.sdf"

Refer DSA quick start for details

Hope this helps
Sep 20, 2007 at 11:51 AM
That helps a little bit. I think that is my problem, but I am not well versed with config-files.
I think I have to put the first part under the <sectionGroup>-tag.
1. But where do I have to put the second part?

2. I work with a webservice that appropiates a method. I am not really able to make use of the Requests.sdf-file.
Do I have to put the reference of the webservice there?

I try to solve the problem now but I would be glad if someone can help me..
Sep 20, 2007 at 1:11 PM
Edited Sep 20, 2007 at 1:24 PM
ok, now I added the lines to the app.config.
I got the same problem if I try to initialize the RequestManager automatically.
If I do it manually, I detect that the ConfigurationManager.ConnectionStrings("QueueDatabase").ConnectionString (should be square brackets) is null although I got these lines in the app.config:

<add name="QueueDatabase" connectionString="DataSource=http://localhost:1737/Service1.asmx" providerName="System.Data.SqlServerCe"/>

EndpointCatalogFactory catalogFactory = new EndpointCatalogFactory("Endpoints");
IEndpointCatalog catalog = catalogFactory.CreateCatalog();

SmartClientDatabase requestQueueDb = new SmartClientDatabase(ConfigurationManager.ConnectionStrings"QueueDatabase".ConnectionString);
DatabaseRequestQueue requestQueue = new DatabaseRequestQueue(requestQueueDb, "RequestsQueue");

SmartClientDatabase deadLetterQueueDb = new SmartClientDatabase(ConfigurationManager.ConnectionStrings"QueueDatabase".ConnectionString);
DatabaseRequestQueue deadLetterQueue = new DatabaseRequestQueue(deadLetterQueueDb,

ConnectionMonitorAdapter adapter = new ConnectionMonitorAdapter(ConnectionMonitorFactory.CreateFromConfiguration());
RequestManager requestManager = RequestManager.Instance;
requestManager.Initialize(requestQueue, deadLetterQueue, adapter, catalog);

Perhaps I cant let the DataSource be a webservice?
Sep 21, 2007 at 10:05 AM
1. Copy the existing Requests.sdf and add this to Inrastructure.Module
2. In App.Config Enterprise lib config, create new connection string QueueDatabase.
3. set the datasource, DataSource=Requests.sdf
4. add below script on ShellApplication.cs
protected override void AddBuilderStrategies(Microsoft.Practices.ObjectBuilder.Builder builder)

protected override void AddServices()
IActionCatalogService actionCatalog = RootWorkItem.Services.Get<IActionCatalogService>();
actionCatalog.RegisterGeneralCondition(new EnterpriseLibraryAuthorizationActionCondition());
5. Set the security block application
Sep 24, 2007 at 8:25 PM
Edited Sep 26, 2007 at 5:26 PM
San wrote:
"Have you added the database file to.."

Do I have to create a new database-file? Actually I dont need a database-file because I have a webservice that appropiates a method HelloWorld(param1, param2, ..) which redelivers some values.

So I have two questions:
1. Can I use the DSA only if I want to do something with databases?

2. How must the database Requests.sdf look like if it is only for the requests?

Thanks for helping,