I got this message("Database name not found in config file")...but not for all objects.
As soon as I use code locally from VS there is no problem.
I start my ServerHost on IIS and start receiving this message...but not for all objects.
Of course, this line
Using ctx = ConnectionManager(Of SqlConnection).GetManager("MyConnectionString")
is exactly the same for every object.
What could be the reason for such a behaviour?
Thanks,
That is strange behavior, I have no idea.
The GetManager method just uses the standard System.Configuration types to get the connection string - the code in GetManager isn't fancy by any means.
Are you using N-Tier (remote DataPortal)?
What is the UI?
If NTier - it could be that some code is executing on the client (without connection string in app.config) by using [RunLocal] attribute on DataPortal XYZ methods.
It's 3 tier setup with remote DataPortal on IIS, as described in the last books. Connecting string is only on remote host in web config file.
UI is WinForms.....I can see that it happened with a new added classes only.
Any cashe problems on IIS?///but I did not changed the name of the ConnectionString.
...I am testing it on the same computer using localhost.
It happened on Update/Add methods of a new added object.
[RunLocal]...Should I remove it and run it on server side?
Hi,
If your new classes has [RunLocal] attribute on DataPortal_XYZ then they will be called on the client - not sent to the server and that would explain why your code is not able to get the ConnectionString.
I just remove [RunLocal] attribute and still got the message.
I added ConnectionString
<connectionStrings>
<add name="ConnectionString"
connectionString="Data Source=EES-SQL-02;Initial Catalog=EER_Testing;User ID=***;Password=*******"
providerName="System.Data.SqlClient" />
</connectionStrings>
into config file together with
<appSettings>
<add key="CslaDataPortalProxy" value="Csla.DataPortalClient.WcfProxy, Csla" />
<add key="ClientSettingsProvider.ServiceUri" value="" />
</appSettings>
<system.serviceModel>
<client>
<endpoint name="WcfDataPortal" address="http://localhost:1179/WcfPortal.svc" binding="wsHttpBinding" bindingConfiguration="wsHttpBinding_IWcfPortal" contract="Csla.Server.Hosts.IWcfPortal" />
</client>
<bindings>
<wsHttpBinding>
<binding name="wsHttpBinding_IWcfPortal" maxReceivedMessageSize="2147483647" receiveTimeout="10" sendTimeout="10">
<readerQuotas maxBytesPerRead="2147483647" maxArrayLength="2147483647" maxStringContentLength="2147483647" maxNameTableCharCount="2147483647" maxDepth="2147483647" />
</binding>
</wsHttpBinding>
</bindings>
</system.serviceModel>
It fixed the problem but I am not sure if I run it remotely with both parts in my config on client.
I would remove the connection string from the client app.config.
Recompile and redistribute the client and server assemblies.
Do NOT use RunLocal attribute on methods that must connect to the database.
It's OK to use RunLocal attribute on DataPortal_Create methods that do not require data access (or connect to the database).
I tried all of those.
RunLocal only on DataPortal_Create methods.
Recompile both parts(client and server), update all references....and still have this message.
Could IsDatabaseName parameter in GetManager function be critical for this issue?
Unbelievable !!!!
I have tried everything and still have this error message. I have no idea what else should I try to check to solve the problem.
Try directly calling the System. Configuration API to get the connection string yourself and see what you get.
Or try using the API to get a made-up entry so you can put this made-up entry on the client AND server with different values. That might help you figure out which config file is being used.
Hi,
My best guess is that some of the new code is not using DataPortal as it should and tries to do data access locally on the client.
Make sure to setup a n-tier development environment and inspect the error message and call stack - this should give a clear indication of how that method is called.
Thanks,
Obviously, that my client is trying to go to database locally without calling remote Data Portal.
Morning is always the better time to think over the yesterday's problems
I think that problem solved. At least I know where to go.
Thanks again for your help,
Copyright (c) Marimer LLC