Distributed SQL Server Cache - Create SQL table programmatically
d

Debasish

about 2 years ago
Hi all, We have set up Distributed SQL Server Cache by following this article https://learn.microsoft.com/en-us/aspnet/core/performance/caching/distributed?view=aspnetcore-7.0. Currently we are running the following create table script manually on the database:
CREATE TABLE [dbo].DistCache
(
    [Id] NVARCHAR(900) NOT NULL PRIMARY KEY, 
    [Value] VARBINARY(MAX) NOT NULL, 
    [ExpiresAtTime] DATETIMEOFFSET NOT NULL, 
    [SlidingExpirationInSeconds] BIGINT NULL, 
    [AbsoluteExpiration] DATETIMEOFFSET NULL
)
I wanted to do this programmatically on application start. I tried to follow this article here https://docs.umbraco.com/umbraco-cms/v/10.latest-lts/extending/database. Here is my Disc Cache Schema
[TableName("dbo.DistCache")]
        [PrimaryKey("Id")]
        [ExplicitColumns]
        public class DistCacheSchema
        {
            [PrimaryKeyColumn()]
            [Column("Id")]
            public String Id { get; set; }

            [Column("Value")]
            public Byte[] Value { get; set; }

            [Column("ExpiresAtTime")]
            public DateTimeOffset ExpiresAtTime { get; set; }

            [Column("SlidingExpirationInSeconds")]
            public Nullable<Int64> SlidingExpirationInSeconds { get; set; }

            [Column("AbsoluteExpiration")]
            public Nullable<DateTimeOffset> AbsoluteExpiration { get; set; }
        }
This fails with the following error message
Microsoft.Data.SqlClient.SqlException: 'Identity column 'Id' must be of data type int, bigint, smallint, tinyint, or decimal or numeric with a scale of 0, unencrypted, and constrained to be nonnullable.'
Any ideas how to get this work?
Umbraco Missing Token
b

Batuhan

9 months ago
GET https://xxxx/umbraco/backoffice/umbracoapi/backofficeassets/GetSupportedLocales [HTTP/1.1 417 The required antiforgery header value "X-UMB-XSRF-TOKEN" is not present. 55ms] XHRGET https://xxxx/umbraco/backoffice/umbracoapi/updatecheck/GetCheck [HTTP/1.1 417 The required antiforgery header value "X-UMB-XSRF-TOKEN" is not present. 49ms] XHRGET https://xxxx/umbraco/backoffice/umbracoapi/tour/GetTours [HTTP/1.1 417 The required antiforgery header value "X-UMB-XSRF-TOKEN" is not present. 49ms] Possibly unhandled rejection: {"errorMsg":"Failed to retrieve update status","data":{"Type":null,"Title":null,"Status":417,"Detail":null,"Instance":null,"Extensions":{"traceId":"00-77fc79600ce289d4941d3917c76681dc-5b464d9b17ecb14e-00"}},"status":417,"xhrStatus":"complete"} umbraco-backoffice-js.js.v638736528350000000:147:202 Possibly unhandled rejection: {"errorMsg":"Failed to get tours","data":{"Type":null,"Title":null,"Status":417,"Detail":null,"Instance":null,"Extensions":{"traceId":"00-ddb3f49c70c1f4a27e8a7eed1022a78c-5fd1c642c2d76123-00"}},"status":417,"xhrStatus":"complete"} umbraco-backoffice-js.js.v638736528350000000:147:202 Possibly unhandled rejection: {"errorMsg":"Failed to get cultures","data":{"Type":null,"Title":null,"Status":417,"Detail":null,"Instance":null,"Extensions":{"traceId":"00-001cd56a98bb2544ce9bf775838cda47-0109191560c0fc9d-00"}},"status":417,"xhrStatus":"complete"} umbraco-backoffice-js.js.v638736528350000000:147:202 Possibly unhandled rejection: {"errorMsg":"Failed to retrieve data for sections","data":{"Type":null,"Title":null,"Status":417,"Detail":null,"Instance":null,"Extensions":{"traceId":"00-76787192761e996646650c48c1f3abff-d92a8c9f5b7b812e-00"}},"status":417,"xhrStatus":"complete"} When I log in, there are tokens related to cookies, but I still get an error like above. I tried everything but it doesn't work. How can I solve it?