asp.net-mvc – 如何在SQL Server中为Asp.Net MVC 4应用程序或We
发布时间:2020-12-16 09:48:20 所属栏目:asp.Net 来源:网络整理
导读:如何在SQL Server中为 Asp.net mvc4或Windows Azure Web角色应用程序存储会话状态? 编辑 为什么我会收到此错误? HTTP Error 500.23 – Internal Server Error An ASP.NET setting has been detected that does not apply in Integrated managed pipeline m
如何在SQL Server中为
Asp.net mvc4或Windows Azure Web角色应用程序存储会话状态?
编辑 为什么我会收到此错误?
我的web.config看起来像这样: <?xml version="1.0" encoding="utf-8"?> <configuration> <configSections> <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup,System.Web.WebPages.Razor,Version=2.0.0.0,Culture=neutral,PublicKeyToken=31BF3856AD364E35"> <section name="webAssets" type="Telerik.Web.Mvc.Configuration.WebAssetConfigurationSection,Telerik.Web.Mvc" requirePermission="false" /> <!-- For more information on Entity Framework configuration,visit http://go.microsoft.com/fwlink/?LinkID=237468 --> <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection,EntityFramework,Version=4.4.0.0,PublicKeyToken=b77a5c561934e089" requirePermission="false" /> </sectionGroup> </configSections> <!-- <connectionStrings> <add name="DefaultConnection" connectionString="Data Source=.SQLEXPRESS;Initial Catalog=aspnet2012620142020;Integrated Security=True" providerName="System.Data.SqlClient"/> </connectionStrings> --> <connectionStrings> <!--<add name="HotDeployDbContext" connectionString="data source=JOE-WANGWQ;initial catalog=HotDeploy;user id=sa;password=wq187731" providerName="System.Data.SqlClient"/>--> <!--<add name="HotDeployDbContext" connectionString="data source=tcp:z1782cwqws.database.windows.net,1433;initial catalog=HotDeployDB4CloudService;user id=hotdeployadmin@z1782cwqws;password=accela.123;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;" providerName="System.Data.SqlClient" />--> <add name="HotDeployDbContext" connectionString="data source=tcp:xxxxxxxx.database.windows.net,1433;initial catalog=xxxxx;user idxxxxx@xxxx;password=dddd.123;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;" providerName="System.Data.SqlClient"/> </connectionStrings> <appSettings> <add key="webpages:Version" value="2.0.0.0" /> <add key="webpages:Enabled" value="true" /> <add key="PreserveLoginUrl" value="true" /> <add key="ClientValidationEnabled" value="true" /> <add key="UnobtrusiveJavaScriptEnabled" value="true" /> </appSettings> <system.web> <customErrors mode="Off" /> <httpRuntime executionTimeout="14400" maxRequestLength="716800" /> <compilation targetFramework="4.0" /> <authentication mode="Forms"> <forms loginUrl="~/Account/Login" timeout="2880" /> </authentication> <pages> <namespaces> <add namespace="System.Web.Helpers" /> <add namespace="System.Web.Mvc" /> <add namespace="System.Web.Mvc.Ajax" /> <add namespace="System.Web.Mvc.Html" /> <add namespace="System.Web.Routing" /> <add namespace="System.Web.WebPages" /> <add namespace="Telerik.Web.Mvc.UI" /> </namespaces> </pages> <profile defaultProvider="DefaultProfileProvider"> <providers> <add name="DefaultProfileProvider" type="System.Web.Providers.DefaultProfileProvider,System.Web.Providers,Version=1.0.0.0,PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" /> </providers> </profile> <membership defaultProvider="DefaultMembershipProvider"> <providers> <add name="DefaultMembershipProvider" type="System.Web.Providers.DefaultMembershipProvider,PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" /> </providers> </membership> <roleManager defaultProvider="DefaultRoleProvider"> <providers> <add name="DefaultRoleProvider" type="System.Web.Providers.DefaultRoleProvider,PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" /> </providers> </roleManager> <!-- <sessionState mode="InProc" timeout="30" customProvider="DefaultSessionProvider"> <providers> <add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider,PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" /> </providers> </sessionState> <httpHandlers> <add verb="GET,HEAD" path="asset.axd" validate="false" type="Telerik.Web.Mvc.WebAssetHttpHandler,Telerik.Web.Mvc" /> </httpHandlers>--> <!--before I added sessionState element . everything is fine.--> <sessionState mode="SQLServer" cookieless="true" sqlConnectionString="data source=10.50.70.81; userid=sa; password=wq187731" timeout="300" sqlCommandTimeout="10" /> </system.web> </configuration> </system.web> <system.webServer> <security> <requestFiltering> <requestLimits maxAllowedContentLength="3000000000" /> </requestFiltering> </security> <validation validateIntegratedModeConfiguration="false" /> <modules runAllManagedModulesForAllRequests="true" /> <directoryBrowse enabled="true" /> <handlers> <remove name="asset" /> <add name="asset" preCondition="integratedMode" verb="GET,HEAD" path="asset.axd" type="Telerik.Web.Mvc.WebAssetHttpHandler,Telerik.Web.Mvc" /> </handlers> </system.webServer> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" /> <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" /> <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" /> <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Microsoft.WindowsAzure.StorageClient" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-1.7.0.0" newVersion="1.7.0.0" /> </dependentAssembly> </assemblyBinding> </runtime> </configuration> 如果我将应用程序池更改为经典模式.我在下面有IIS错误页面..
解决方法
使用
sessionState元素在web.config中配置会话状态提供程序.对于SQL Server,您将模式设置为SQLServer并配置连接字符串.对于Azure,您可以查看涵盖不同选项的
following answer.
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net-mvc – 控制器中的模拟服务器
- .net – oData v4简单来说什么是函数和动作?
- asp.net-mvc – 在Asp.Net MVC中使用千位分隔符的十进制值
- ASP.NET Core使用Elasticsearch记录NLog日志
- asp.net – Stack Overflow的Mini Profiler
- Asp.net Core 使用Jenkins + Dockor 实现持续集成、自动化部
- asp.net – JQGrid不显示数据
- asp.net-mvc-4 – MVC4 MEF插件和控制器命名空间
- Linq高级查询
- asp.net – 为什么无法使用ID“Server”进行控制
推荐文章
站长推荐
- Asp.net 4.0 Forms Authentication和FriendlyUrl
- 在ASP.NET MVC中使用MySQL的AccountController
- asp.net-mvc – 无法在mvc 4中映射特定控制器的路
- asp.net-mvc-3 – 如何将int数组传递给RouteValu
- asp.net-mvc – ASP.NET MVC自动解码来自AJAX的J
- asp.net – Datareader,DataAdapter,Dataset,Dat
- asp.net-mvc – ASP.NET MVC中声明性HTML帮助程序
- asp.net – ashx处理程序DELETE请求不工作HTTP 4
- asp.net-mvc – ASP.NET MVC 4移动显示模式停止工
- asp.net-mvc – 如何从HttpContext访问ViewData?
热点阅读