You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Redis Output Cache Provider NuGet package has a dependency on the StackExchange.Redis package. If the StackExchange.Redis package isn't present in your project, it's installed. For more information about the Redis Output Cache Provider NuGet package, see the [RedisOutputCacheProvider](https://www.nuget.org/packages/Microsoft.Web.RedisOutputCacheProvider/) NuGet page.
29
+
The Redis Output Cache Provider NuGet package has a dependency on the _StackExchange.Redis_ package. If the _StackExchange.Redis_ package isn't present in your project, it gets installed. For more information about the Redis Output Cache Provider NuGet package, see the [RedisOutputCacheProvider](https://www.nuget.org/packages/Microsoft.Web.RedisOutputCacheProvider/) NuGet page.
30
30
31
31
The NuGet package downloads and adds the required assembly references and adds the following section into your web.config file. This section contains the required configuration for your ASP.NET application to use the Redis Output Cache Provider.
32
32
@@ -47,28 +47,28 @@ Configure the attributes in the first c with the values from your cache in the M
47
47
48
48
| Attribute | Type | Default | Description |
49
49
| --------- | ---- | ------- | ----------- |
50
-
|*host*| string | "localhost" | The Redis server IP address or host name |
51
-
|*port*| positive integer | 6379 (non-TLS/SSL)<br/>6380 (TLS/SSL) | Redis server port |
52
-
|*accessKey*| string | "" | Redis server password when Redis authorization is enabled. The value is an empty string by default, which means the session state provider doesn't use any password when it connects to Redis server. **If your Redis server is in a publicly accessible network like Azure Cache for Redis, be sure to enable Redis authorization to improve security, and provide a secure password.**|
53
-
|*ssl*| boolean |**false**| Whether to connect to Redis server via TLS. This value is **false** by default because Redis doesn’t support TLS by default. **If you're using Azure Cache for Redis, which supports SSL by default, be sure to set this value to true to improve security.**<br/><br/>The non-TLS port is disabled by default for new caches. Specify **true** for this setting to use the non-TLS port. For more information about enabling the non-TLS port, see the [Access Ports](cache-configure.md#access-ports) section in the [Configure a cache](cache-configure.md) article. |
54
-
|*databaseIdNumber*| positive integer | 0 |*This attribute can be specified only through either web.config or AppSettings.*<br/><br/>Specify which Redis database to use. |
55
-
|*connectionTimeoutInMilliseconds*| positive integer | Provided by StackExchange.Redis | Used to set *ConnectTimeout* when creating StackExchange.Redis.ConnectionMultiplexer. |
56
-
|*operationTimeoutInMilliseconds*| positive integer | Provided by StackExchange.Redis | Used to set *SyncTimeout* when creating StackExchange.Redis.ConnectionMultiplexer. |
57
-
|*connectionString* (Valid StackExchange.Redis connection string) | string |*n/a*| Either a parameter reference to AppSettings or web.config, or else a valid StackExchange.Redis connection string. This attribute can provide values for *host*, *port*, *accessKey*, *ssl*, and other StackExchange.Redis attributes. For a closer look at *connectionString*, see [Setting connectionString](#setting-connectionstring) in the [Attribute notes](#attribute-notes) section. |
58
-
|*settingsClassName*<br/>*settingsMethodName*| string<br/>string |*n/a*|*These attributes can be specified only through either web.config or AppSettings.*<br/><br/>Use these attributes to provide a connection string. *settingsClassName* should be an assembly qualified class name that contains the method specified by *settingsMethodName*.<br/><br/>The method specified by *settingsMethodName* should be public, static, and void (accepting no parameters), with a return type of **string**. This method returns the actual connection string. |
59
-
|*loggingClassName*<br/>*loggingMethodName*| string<br/>string |*n/a*|*These attributes can be specified only through either web.config or AppSettings.*<br/><br/>Use these attributes to debug your application by providing logs from Session State/Output Cache along with logs from StackExchange.Redis. *loggingClassName* should be an assembly qualified class name that contains the method specified by *loggingMethodName*.<br/><br/>The method specified by *loggingMethodName* should be public, static, and void (accept no parameters), with a return type of **System.IO.TextWriter**. |
60
-
|*applicationName*| string | The module name of the current process or "/" |*SessionStateProvider only*<br/>*This attribute can be specified only through either web.config or AppSettings.*<br/><br/>The app name prefix to use in Redis cache. The customer might use the same Redis cache for different purposes. To ensure that the session keys don't collide, it can be prefixed with the application name. |
61
-
|*throwOnError*| boolean | true |*SessionStateProvider only*<br/>*This attribute can be specified only through either web.config or AppSettings.*<br/><br/>Whether to throw an exception when an error occurs.<br/><br/>For more about *throwOnError*, see [Notes on *throwOnError*](#notes-on-throwonerror) in the [Attribute notes](#attribute-notes) section. |
62
-
|*retryTimeoutInMilliseconds*| positive integer | 5000 |*SessionStateProvider only*<br/>*This attribute can be specified only through either web.config or AppSettings.*<br/><br/>How long to retry when an operation fails. If this value is less than *operationTimeoutInMilliseconds*, the provider doesn't retry.<br/><br/>For more about *retryTimeoutInMilliseconds*, see [Notes on *retryTimeoutInMilliseconds*](#notes-on-retrytimeoutinmilliseconds) in the [Attribute notes](#attribute-notes) section. |
63
-
|*redisSerializerType*| string |*n/a*| Specifies the assembly qualified type name of a class that implements Microsoft.Web.Redis. Serializer and that contains the custom logic to serialize and deserialize the values. For more information, see [About *redisSerializerType*](#about-redisserializertype) in the [Attribute notes](#attribute-notes) section. |
50
+
|_host*| string | "localhost" | The Redis server IP address or host name |
51
+
|_port_| positive integer | 6379 (non-TLS/SSL)<br/>6380 (TLS/SSL) | Redis server port |
52
+
|_accessKey_| string | "" | Redis server password when Redis authorization is enabled. The value is an empty string by default, which means the session state provider doesn't use any password when it connects to Redis server. **If your Redis server is in a publicly accessible network like Azure Cache for Redis, be sure to enable Redis authorization to improve security, and provide a secure password.**|
53
+
|_ssl_| boolean |**false**| Whether to connect to Redis server via TLS. This value is **false** by default because Redis doesn’t support TLS by default. **If you're using Azure Cache for Redis, which supports SSL by default, be sure to set this value to true to improve security.**<br/><br/>The non-TLS port is disabled by default for new caches. Specify **true** for this setting to use the non-TLS port. For more information about enabling the non-TLS port, see the [Access Ports](cache-configure.md#access-ports) section in the [Configure a cache](cache-configure.md) article. |
54
+
|_databaseIdNumber_| positive integer | 0 |_This attribute can be specified only through either web.config or AppSettings._<br/><br/>Specify which Redis database to use. |
55
+
|_connectionTimeoutInMilliseconds_| positive integer | Provided by StackExchange.Redis | Used to set _ConnectTimeout_ when creating StackExchange.Redis.ConnectionMultiplexer. |
56
+
|_operationTimeoutInMilliseconds_| positive integer | Provided by StackExchange.Redis | Used to set _SyncTimeout_ when creating StackExchange.Redis.ConnectionMultiplexer. |
57
+
|_connectionString_ (Valid StackExchange.Redis connection string) | string |_n/a_| Either a parameter reference to AppSettings or web.config, or else a valid StackExchange.Redis connection string. This attribute can provide values for _host_, _port_, _accessKey_, _ssl_, and other StackExchange.Redis attributes. For a closer look at _connectionString_, see [Setting connectionString](#setting-connectionstring) in the [Attribute notes](#attribute-notes) section. |
58
+
|_settingsClassName_<br/>_settingsMethodName_| string<br/>string |_n/a_|_These attributes can be specified only through either web.config or AppSettings._<br/><br/>Use these attributes to provide a connection string. _settingsClassName* should be an assembly qualified class name that contains the method specified by _settingsMethodName_.<br/><br/>The method specified by _settingsMethodName_ should be public, static, and void (accepting no parameters), with a return type of **string**. This method returns the actual connection string. |
59
+
|_loggingClassName_<br/>_loggingMethodName_| string<br/>string |_n/a_|_These attributes can be specified only through either web.config or AppSettings._<br/><br/>Use these attributes to debug your application by providing logs from Session State/Output Cache along with logs from StackExchange.Redis. _loggingClassName_ should be an assembly qualified class name that contains the method specified by _loggingMethodName_.<br/><br/>The method specified by _loggingMethodName_ should be public, static, and void (accept no parameters), with a return type of **System.IO.TextWriter**. |
60
+
|_applicationName_| string | The module name of the current process or "/" |_SessionStateProvider only_<br/>_This attribute can be specified only through either web.config or AppSettings._<br/><br/>The app name prefix to use in Redis cache. The customer might use the same Redis cache for different purposes. To ensure that the session keys don't collide, it can be prefixed with the application name. |
61
+
|_throwOnError_| boolean | true |_SessionStateProvider only_<br/>_This attribute can be specified only through either web.config or AppSettings._<br/><br/>Whether to throw an exception when an error occurs.<br/><br/>For more about _throwOnError_, see [Notes on _throwOnError_](#notes-on-throwonerror) in the [Attribute notes](#attribute-notes) section. |
62
+
|_retryTimeoutInMilliseconds_| positive integer | 5000 |_SessionStateProvider only_<br/>_This attribute can be specified only through either web.config or AppSettings._<br/><br/>How long to retry when an operation fails. If this value is less than _operationTimeoutInMilliseconds_, the provider doesn't retry.<br/><br/>For more about _retryTimeoutInMilliseconds_, see [Notes on _retryTimeoutInMilliseconds_](#notes-on-retrytimeoutinmilliseconds) in the [Attribute notes](#attribute-notes) section. |
63
+
|_redisSerializerType_| string |_n/a_| Specifies the assembly qualified type name of a class that implements Microsoft.Web.Redis. Serializer and that contains the custom logic to serialize and deserialize the values. For more information, see [About _redisSerializerType_](#about-redisserializertype) in the [Attribute notes](#attribute-notes) section. |
64
64
65
65
## Attribute notes
66
66
67
-
### Setting *connectionString*
67
+
### Setting _connectionString_
68
68
69
-
The value of *connectionString* is used as key to fetch the actual connection string from AppSettings, if such a string exists in AppSettings. If not found inside AppSettings, the value of *connectionString* is used as key to fetch actual connection string from the web.config **ConnectionString** section, if that section exists. If the connection string doesn't exist in AppSettings or the web.config **ConnectionString** section, the literal value of *connectionString* is used as the connection string when creating StackExchange.Redis.ConnectionMultiplexer.
69
+
The value of _connectionString_ is used as key to fetch the actual connection string from AppSettings, if such a string exists in AppSettings. If not found inside AppSettings, the value of _connectionString_ is used as key to fetch actual connection string from the web.config **ConnectionString** section, if that section exists. If the connection string doesn't exist in AppSettings or the web.config **ConnectionString** section, the literal value of _connectionString_ is used as the connection string when creating StackExchange.Redis.ConnectionMultiplexer.
70
70
71
-
The following examples illustrate how *connectionString* is used.
71
+
The following examples illustrate how _connectionString_ is used.
72
72
73
73
#### Example 1
74
74
@@ -122,25 +122,25 @@ In `web.config`, use the key as parameter value instead of actual value.
122
122
</sessionState>
123
123
```
124
124
125
-
### Notes on *throwOnError*
125
+
### Notes on _throwOnError_
126
126
127
127
Currently, if an error occurs during a session operation, the session state provider throws an exception. Throwing the exception shuts down the application.
128
128
129
129
This behavior was modified in a way that supports the expectations of existing ASP.NET session state provider users while also allowing you to act on exceptions. The default behavior still throws an exception when an error occurs, consistent with other ASP.NET session state providers. Existing code should work the same as before.
130
130
131
-
If you set *throwOnError* to **false**, then instead of throwing an exception when an error occurs, it fails silently. To see if there was an error and, if so, discover what the exception was, check the static property *Microsoft.Web.Redis.RedisSessionStateProvider.LastException*.
131
+
If you set _throwOnError_ to **false**, then instead of throwing an exception when an error occurs, it fails silently. To see if there was an error and, if so, discover what the exception was, check the static property _Microsoft.Web.Redis.RedisSessionStateProvider.LastException_.
132
132
133
-
### Notes on *retryTimeoutInMilliseconds*
133
+
### Notes on _retryTimeoutInMilliseconds_
134
134
135
-
The *retryTimeoutInMilliseconds* setting provides some logic to simplify the case where a session operation should retry on failure because of a network glitch or something else. The *retryTimeoutInMilliseconds* setting also allows you to control the retry timeout or to completely opt out of retry.
135
+
The _retryTimeoutInMilliseconds_ setting provides some logic to simplify the case where a session operation should retry on failure because of a network glitch or something else. The _retryTimeoutInMilliseconds_ setting also allows you to control the retry timeout or to completely opt out of retry.
136
136
137
-
If you set *retryTimeoutInMilliseconds* to a number, for example 2000, when a session operation fails, it retries for 2,000 milliseconds before treating it as an error. To have the session state provider apply this retry logic, just configure the timeout. The first retry will happen after 20 milliseconds, which is sufficient in most cases when a network glitch happens. After that, it will retry every second until it times out. Right after the time-out, it will retry one more time to make sure that it won’t cut off the timeout by (at most) one second.
137
+
If you set _retryTimeoutInMilliseconds_ to a number, for example 2000, when a session operation fails, it retries for 2,000 milliseconds before treating it as an error. To have the session state provider apply this retry logic, just configure the timeout. The first retry will happen after 20 milliseconds, which is sufficient in most cases when a network glitch happens. After that, it will retry every second until it times out. Right after the time-out, it will retry one more time to make sure that it won’t cut off the timeout by (at most) one second.
138
138
139
-
If you don’t think you need retry or if you want to handle the retry logic yourself, set *retryTimeoutInMilliseconds* to 0. For example, you might not want retry when you're running the Redis server on the same machine as your application.
139
+
If you don’t think you need retry or if you want to handle the retry logic yourself, set _retryTimeoutInMilliseconds_ to 0. For example, you might not want retry when you're running the Redis server on the same machine as your application.
140
140
141
-
### About *redisSerializerType*
141
+
### About _redisSerializerType_
142
142
143
-
The serialization to store the values on Redis is done in a binary format by default, which is provided by the **BinaryFormatter** class. Use *redisSerializerType* to specify the assembly qualified type name of a class that implements **Microsoft.Web.Redis.ISerializer** and has the custom logic to serialize and deserialize the values. For example, here's a Json serializer class using JSON.NET:
143
+
The serialization to store the values on Redis is done in a binary format by default, which is provided by the **BinaryFormatter** class. Use _redisSerializerType_ to specify the assembly qualified type name of a class that implements **Microsoft.Web.Redis.ISerializer** and has the custom logic to serialize and deserialize the values. For example, here's a Json serializer class using JSON.NET:
144
144
145
145
```cs
146
146
namespaceMyCompany.Redis
@@ -166,7 +166,7 @@ namespace MyCompany.Redis
166
166
}
167
167
```
168
168
169
-
Assuming this class is defined in an assembly with name **MyCompanyDll**, you can set the parameter *redisSerializerType* to use it:
169
+
Assuming this class is defined in an assembly with name **MyCompanyDll**, you can set the parameter _redisSerializerType_ to use it:
0 commit comments