Method call does not work over WCF

Posts   
 
    
FarhadB
User
Posts: 28
Joined: 28-Feb-2011
# Posted on: 04-Mar-2011 14:07:15   

Hi

After generating and trying to access data, I am receiving the error attached.....I assum that the connectionString initializing is taken care of internally?

Let me add a bit more info.......If I instantiate my class explicity and call the method, it works fine...but if I call this method over WCF it does not work and comes up with the error in the pic

LLBLGen Pro ver3.1 Template Group: Adapter - .Net4.0

Stack trace at System.Data.SqlClient.SqlConnection.PermissionDemand() at System.Data.SqlClient.SqlConnectionFactory.PermissionDemand(DbConnection outerConnection) at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) at System.Data.SqlClient.SqlConnection.Open() at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.OpenConnection() in c:\Myprojects\VS.NET Projects\LLBLGen Pro v3.1\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\AdapterSpecific\DataAccessAdapterBase.cs:line 1089 at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.PrepareQueryExecution(IQuery queryToExecute, Boolean forceConnectionSet) in c:\Myprojects\VS.NET Projects\LLBLGen Pro v3.1\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\AdapterSpecific\DataAccessAdapterBase.cs:line 5651 at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.ExecuteSingleRowRetrievalQuery(IRetrievalQuery queryToExecute, IEntityFields2 fieldsToFill, IFieldPersistenceInfo[] fieldsPersistenceInfo) in c:\Myprojects\VS.NET Projects\LLBLGen Pro v3.1\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\AdapterSpecific\DataAccessAdapterBase.cs:line 565 at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchEntityUsingFilter(IEntityFields2 fieldsToFetch, IFieldPersistenceInfo[] persistenceInfos, IRelationPredicateBucket filter) in c:\Myprojects\VS.NET Projects\LLBLGen Pro v3.1\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\AdapterSpecific\DataAccessAdapterBase.cs:line 4892 at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchEntityUsingFilter(IEntity2 entityToFetch, IPrefetchPath2 prefetchPath, Context contextToUse, IRelationPredicateBucket filter, ExcludeIncludeFieldsList excludedIncludedFields) in c:\Myprojects\VS.NET Projects\LLBLGen Pro v3.1\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\AdapterSpecific\DataAccessAdapterBase.cs:line 4829 at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchEntity(IEntity2 entityToFetch, IPrefetchPath2 prefetchPath, Context contextToUse, ExcludeIncludeFieldsList excludedIncludedFields) in c:\Myprojects\VS.NET Projects\LLBLGen Pro v3.1\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\AdapterSpecific\DataAccessAdapterBase.cs:line 1834 at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchEntity(IEntity2 entityToFetch) in c:\Myprojects\VS.NET Projects\LLBLGen Pro v3.1\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\AdapterSpecific\DataAccessAdapterBase.cs:line 1755 at Commissions.Services.CommConsultantService.GetConsultant(Int32 consno) in C:\ERPTesting\PresLesERP\CommissionsModule\Commissions.Services\CommConsultantService.cs:line 25 at SyncInvokeGetConsultant(Object , Object[] , Object[] ) at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs) at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)

Attachments
Filename File size Added on Approval
error.JPG 34,157 04-Mar-2011 14:08.18 Approved
daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 04-Mar-2011 22:58:37   

FarhadB wrote:

After generating and trying to access data, I am receiving the error attached.....I assum that the connectionString initializing is taken care of internally?

No. You have to set up your connection string in the config file. When you generate code, a app.config file is generated in your DBSpecific project. You can see that to know the name of the key. For more info Read the manual

David Elizondo | LLBLGen Support Team
FarhadB
User
Posts: 28
Joined: 28-Feb-2011
# Posted on: 05-Mar-2011 18:18:38   

FarhadB wrote:

Hi If I instantiate my class explicity and call the method, it works fine...but if I call this method over WCF it does not work and comes up with the error in the pic

Hi....

Thanks for the reply.......So why would it work if I instantiate the class explicity....as my app.config is setup correctly?



//This works fine....So I assume that my app.config is correct as it is exactly the same file as the DBSpecific(I copied it over to this test project)
ConsultantService cs = new ConsultantService();

Entity2 consultant = cs.GetConsultant(89345);


//This does not work.....
//My host runs fine and holds an instantiated class object of type ConsultantService

ChannelFactory<IConsultantService> channelFactory =
        new ChannelFactory<IConsultantService>("ConsultantServer");
IConsultantService messageSender = channelFactory.CreateChannel();

IEntity2 consultant = messageSender.GetConsultant(89345);