Question

System.ServiceModel.ServiceActivationException: Set AspNetCompatibilityEnabled true

Hello team,

We are encountering the following exception while dealing with UserConnection.

System.ServiceModel.ServiceActivationException: Set AspNetCompatibilityEnabled true
   at Terrasoft.Web.Common.BaseService.get_UserConnection()
   at Terrasoft.Configuration.UsrDeliqDBEntry.UsrdeliqDBEntry.<saveCheckIndatabase>d__7.MoveNext()

Could you please let us know if we are missing anything?

[ServiceContract]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
public class UsrdeliqDBEntry : BaseService
{
 
 	private readonly UsrLogger usrLogger = UsrLogger.Instance;
    private Guid transRefId { get; set; }
    Guid intendedUserId= Guid.Empty;
 
 
		[OperationContract]
       [WebInvoke(Method = "POST", RequestFormat = WebMessageFormat.Json, BodyStyle = 
 WebMessageBodyStyle.Wrapped,
       ResponseFormat = WebMessageFormat.Json)]
		public async Task&lt;string&gt; saveCheckIndatabase(string documentId, string documentType, string customerId, Guid transRefId, Guid currentUserId)
        {
         var logger = global::Common.Logging.LogManager.GetLogger("MyLogger");
 
       try
       {var intendedUserSelect= new Select(UserConnection)
                 							 .Column("Id")
                 							 .From("SysAdminUnit")
                 							 .Where("ContactId").IsEqual(Column.Parameter(currentUserId))
                                 			  as Select;
            intendedUserId = intendedUserSelect.ExecuteScalar&lt;Guid&gt;();
       }
       catch(Exception e)
       {
       	logger.Info("Exception ="+ e.ToString());
       }

 

Like 0

Like

3 comments

Hello Shivani,

 

Please see this community post https://community.creatio.com/questions/generate-and-send-printable-email-started-timer where the same problem was discussed. 

 

Best regards,

Oscar

Oscar Dylan,

Looks like my case is different. How do I get UserConnection in a source code schema which is being called from another webservice configuration?

Shivani Lakshman,

 

Judging from your last comment you are calling this method, not like a web service but rather like a regular method of the class. Such an issue occurs when you are trying to obtain UserConnection in the code that runs in the background (in case of the article that Oscar has sent previously it happens because after timer element the process is executed in the background). You can try to pass userConnection to the method itself from where you call it. Also, you can try getting userConnection in the following way: 

private SystemUserConnection _systemUserConnection;
        private SystemUserConnection SystemUserConnection
        {
            get
            {
                return _systemUserConnection ?? (_systemUserConnection = (SystemUserConnection) AppConnection.SystemUserConnection);
            }
        }

 

 

Best regards, 

Dennis 

Show all comments