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.d__7.MoveNext()

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

[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
public class UsrdeliqDBEntry : BaseService
 	private readonly UsrLogger usrLogger = UsrLogger.Instance;
    private Guid transRefId { get; set; }
    Guid intendedUserId= Guid.Empty;
       [WebInvoke(Method = "POST", RequestFormat = WebMessageFormat.Json, BodyStyle = 
       ResponseFormat = WebMessageFormat.Json)]
		public async Task<string> saveCheckIndatabase(string documentId, string documentType, string customerId, Guid transRefId, Guid currentUserId)
         var logger = global::Common.Logging.LogManager.GetLogger("MyLogger");
       {var intendedUserSelect= new Select(UserConnection)
                                 			  as Select;
            intendedUserId = intendedUserSelect.ExecuteScalar<Guid>();
       catch(Exception e)
       	logger.Info("Exception ="+ e.ToString());


Like 0



Hello Shivani,


Please see this community post where the same problem was discussed. 


Best regards,


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
                return _systemUserConnection ?? (_systemUserConnection = (SystemUserConnection) AppConnection.SystemUserConnection);



Best regards, 


Show all comments