GVKun编程网logo

带有allowCustomSqlDatabase =“true”的ASP.NET SessionState不会调用指定的数据库

13

对于想了解带有allowCustomSqlDatabase=“true”的ASP.NETSessionState不会调用指定的数据库的读者,本文将是一篇不可错过的文章,并且为您提供关于HowToSet

对于想了解带有allowCustomSqlDatabase =“true”的ASP.NET SessionState不会调用指定的数据库的读者,本文将是一篇不可错过的文章,并且为您提供关于 How To Set a NLS Session Parameter At Database Or Schema Level For All Connections?、./runInstaller: line 97: /home/oracle/database/install/.oui: Permission denied、.net – 为什么在使用带有AutoGenerateColumns =“True”的DataGrid时会忽略DataAnnotations、Application log save debug - how log data is persisted to database table的有价值信息。

本文目录一览:

带有allowCustomSqlDatabase =“true”的ASP.NET SessionState不会调用指定的数据库

带有allowCustomSqlDatabase =“true”的ASP.NET SessionState不会调用指定的数据库

这里的Microsoft文档

http://msdn.microsoft.com/en-us/library/h6bb9cz9(v=vs.90).aspx

和几篇SO文章表明,在ASP.NET web.config文件的sessionState声明中指定allowCustomsqlDatabase =“true”将允许我使用默认的ASPState数据库覆盖并指定我自己的数据库名称.

我在web.config文件中设置了这些属性.

<sessionState allowCustomsqlDatabase="true" mode="sqlServer" sqlConnectionString="Data Source=MysqLservername;Initial Catalog=DR_ASPState;Integrated Security=true;Connect Timeout=15;" />

当我尝试调出默认网站页面时,收到一条错误消息,指出无法访问ASPState数据库.

我已使用sql事件探查器监视sql流量,并注意到此故障是由此请求引起的:

SELECT @appId = AppId
FROM [ASPState].dbo.ASPStateTempApplications
WHERE AppName = @appName

我已经回收了应用程序池并重新启动了IIS,试图刷新可能存在的任何缓存的数据库名称引用,但这没有帮助.我的理解是ASP.NET SessionState将使用我指定的数据库名称DR_ASPState来生成它用于连接到SessionState数据库的sql语句.但看起来似乎[ASPState]被硬编码到框架中.

任何人都可以发现我做错的任何事情或提供有关如何解决这个问题的有用的故障排除信息吗?

解决方法

我发现了这个问题.我们的IT团队通过恢复现有ASPState数据库的备份创建了自定义ASP会话状态数据库DR_ASPState.但是,仅提供不同的名称不会更改使用硬编码数据库引用生成的存储过程.

该网站正在调用我的连接字符串中定义的正确备用数据库DR_ASPState.但是,.NET命令生成的至少一个存储过程在存储过程语句中具有硬编码的数据库名称.

使用sql事件探查器,我发现这是使用重命名的数据库导致问题的语句

declare @p2 int
set @p2=NULL
exec dbo.TempGetAppID @appName='/LM/W3SVC/10/ROOT',@appId=@p2 output
select @p2

检查存储过程dbo.TempGetAppID显示如下语句:

SELECT @appId = AppId
FROM [ASPState].dbo.ASPStateTempApplications
WHERE AppName = @appName

根据此处.NET文档中的说明,通过正确安装DR_ASPState作为新数据库,可以正确解决此问题.

http://msdn.microsoft.com/en-us/library/ms229862(v=vs.80).aspx

该声明应该从我们的Web服务器执行.

aspnet_regsql.exe -S *servername* -E -ssadd -sstype c –d DR_ASPState

  How To Set a NLS Session Parameter At Database Or Schema Level For All Connections?

How To Set a NLS Session Parameter At Database Or Schema Level For All Connections?

How To Set a NLS Session Parameter At Database Or Schema Level For All Connections? (Doc ID 251044.1)

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=335038610424309&parent=DOCUMENT&sourceId=115001.1&id=251044.1&_afrWindowMode=0&_adf.ctrl-state=eqr5gy0az_53

APPLIES TO:
Oracle Database - Enterprise Edition - Version 8.0.3.0 to 11.2.0.3 [Release 8.0.3 to 11.2]
Oracle Database - Enterprise Edition - Version 11.2.0.4 to 11.2.0.4 [Release 11.2]
Information in this document applies to any platform.
PURPOSE
How to define some NLS session parameters for all clients, regardless of the used NLS_LANG (or other NLS parameter) setting on the client side

SCOPE
Anyone who want to control NLS settings from the server side.

DETAILS
Why to set a NLS session parameter at Database or Schema level for all connections?
The client side NLS setting will override the instance NLS settings like documented in Note 241047.1 The Priority of NLS Parameters Explained.

So you have no "server side" control on the used NLS session settings as they are derived from the client side.

However, if you like to overwrite some NLS session parameters for all clients, regardless of the used NLS_LANG (or other NLS parameter) setting on the client side then you can do that, for most environments, in the way described in this note.
Please note that:

* Oracle recommends you to define always the (correct) NLS_LANG.
The <characterset> part of the NLS_LANG is a (very important) client only parameter and cannot be set or defined from server side for a session.
Why this is so important is documented in Note 158577.1 and note 179133.1

* This is *not* working for some JDBC drivers , see Note 115001.1 NLS_LANG Client Settings and JDBC Drivers
And may also not work for other 3the party connection methods,if the connector issues from the driver itself alter sessions after the logon procedure of Oracle is done then they will override the trigger.

* When using a PL/SQL package procedure called by the logon trigger and this has any unhandled exceptions or raises any exceptions, then the logon trigger fails. When the logon trigger fails, the logon fails, that is, the user is denied permission to log in to the database

* We do NOT recommend to have several "after logon" triggers, for setting NLS parameters seen the execution order may differ. See Note 121196.1 Fire Sequence of Database Triggers
How to set a NLS session parameter at database level for all connections ?
Create an event trigger like this:
(Example for the NLS_TIMESTAMP_TZ_FORMAT parameter)

CREATE OR REPLACE TRIGGER sys.global_nls_session_settings AFTER LOGON ON DATABASE
BEGIN
execute immediate ''alter session set NLS_TIMESTAMP_TZ_FORMAT =''''DD/MM/YYYY HH24:MI:SS TZR TZD'''''';
END;
/
How to set a NLS session parameter at schema level for all connections ?
You can also create a logon trigger for one schema:
(Example for the NLS_DATE_FORMAT and NLS_NUMERIC_CHARACTERS parameter for the scott schema)
CREATE OR REPLACE TRIGGER sys.schema_nls_session_settings AFTER LOGON ON SCOTT.SCHEMA
BEGIN
execute immediate ''alter session set NLS_DATE_FORMAT=''''DD/MM/YYYY HH24:MI:SS'''''';
execute immediate ''alter session set NLS_NUMERIC_CHARACTERS=''''.,'''''';
END;
/
What NLS parameters can be set using logon triggers?
The parameters which can be set like this, are all the NLS parameters you can do an alter session for:

8i and up:

NLS_CALENDAR 
NLS_COMP 
NLS_CREDIT 
NLS_CURRENCY 
NLS_DATE_FORMAT 
NLS_DATE_LANGUAGE 
NLS_DEBIT 
NLS_ISO_CURRENCY 
NLS_LANGUAGE 
NLS_LIST_SEPARATOR 
NLS_MONETARY_CHARACTERS 
NLS_NUMERIC_CHARACTERS 
NLS_SORT 
NLS_TERRITORY 
NLS_DUAL_CURRENCY
NLS_TIMESTAMP_FORMAT
NLS_TIMESTAMP_TZ_FORMAT

new in 9i/10g:
NLS_LENGTH_SEMANTICS
NLS_NCHAR_CONV_EXCP
note: NLS_TIME_FORMAT and NLS_TIME_TZ_FORMAT are used internally only and should NOT be set or altered

Again, the client character set CANNOT be set or defined this way.
How to see if there are logon triggers?
This select gives you all defined after logon triggers:

conn / as sysdba
select OWNER, TRIGGER_NAME, TRIGGER_BODY from DBA_TRIGGERS where 
 trim(TRIGGERING_EVENT) = ''LOGON''
/
select OWNER, TRIGGER_NAME, TRIGGER_BODY from DBA_TRIGGERS where 
 upper(TRIGGER_NAME) = ''LOGON_PROC''
/

REFERENCES
NOTE:115001.1 - NLS_LANG Client Settings and JDBC Drivers
NOTE:241047.1 - The Priority of NLS Parameters Explained (Where To Define NLS Parameters)
	
 	
Was this document helpful?
 
 	 	 
 	
Document Details
 
Email link to this documentOpen document in new windowPrintable Page
	
Type:
Status:
Last Major Update:
Last Update:
BULLETIN
PUBLISHED
16-Jul-2015
06-Dec-2016

 	 	 

 	
Related Products
 
	
Oracle Database - Enterprise Edition
Oracle Database - Enterprise Edition
 	 	 
 	
Information Centers
 
			
Information Center: Overview Database Server/Client Installation and Upgrade/Migration [1351022.2]

Index of Oracle Database Information Centers [1568043.2]

インフォメーション・センター: データベースおよび Enterprise Manager 日本語ドキュメント [1946305.2]

Information Center: Overview of Database Security Products [1548952.2]

 	 	 
 	
Document References
 
 	 	 
 	
Recently Viewed
 
	How To Set a NLS Session Parameter At Database Or Schema Level For All Connections? [251044.1]	

	NLS_LANG Client Settings and JDBC Drivers [115001.1]	

	IF: High Requests on dc_rollback_segments [1951703.1]	

	WebLogic Server:使用XA Datasource发生 - 获取“XAER_NOTA:XID无效”异常 [2357599.1]	

	How to Validate Network and Name Resolution Setup for the Clusterware and RAC [1054902.1]	

Show More
 	 	 
Didn''t find what you are looking for?Ask in Community...

 
Related
 
 
Products
 
Oracle Database Products > Oracle Database Suite > Oracle Database > Oracle Database - Enterprise Edition > RDBMS
Oracle Database Products > Oracle Database Suite > Oracle Database > Oracle Database - Enterprise Edition > RDBMS > NLS Conversion issues, Characterset Conversion, Characterset issues (lossy and truncation data)

 

 

./runInstaller: line 97: /home/oracle/database/install/.oui: Permission denied

./runInstaller: line 97: /home/oracle/database/install/.oui: Permission denied

解决方法:

用root用户登录,切换到database目录的上级目录下,依次执行以下命令:

chown -R oracle:install database
chmod -R 755 database

最后文件权限如下图:

.net – 为什么在使用带有AutoGenerateColumns =“True”的DataGrid时会忽略DataAnnotations

.net – 为什么在使用带有AutoGenerateColumns =“True”的DataGrid时会忽略DataAnnotations

我正在使用 WPF DataGrid绑定到自定义类的集合.在网格XAML中使用AutoGenerateColumns =“True”,网格被创建并填充得很好,但标题是属性名称,正如人们所期望的那样.

我试过指定

<display(Name:="My Name")>

从System.ComponentModel.DataAnnotations命名空间,它没有任何效果.我也试过了

<displayName("My Name")>

从System.ComponentModel名称空间,但标题仍然不受影响.

是否无法使用AutoGenerateColumns选项指定列标题?

解决方法

使用@ marc的建议是解决方案的开始,但是它自己采用,AutoGenerated列仍然将属性名称作为标题.

要获取displayName,您需要添加一个例程(在后面的代码中)来处理GridAutoGeneratingColumn事件:

Private Sub OnGeneratingColumn(sender As Object,e As System.Windows.Controls.DataGridAutoGeneratingColumnEventArgs) Handles Grid.AutoGeneratingColumn
    Dim pd As System.ComponentModel.PropertyDescriptor = e.PropertyDescriptor
    e.Column.Header = pd.displayName
End Sub

另一个更好的解决方案是使用ComponentModel.DataAnnotations命名空间并指定ShortName:

Public Class modelQ016
    <display(shortname:="DB Name")>
    Public Property dbnAME As String
    ...

OnGeneratingColumn成为:

Dim pd As System.ComponentModel.PropertyDescriptor = e.PropertyDescriptor
        Dim displayAttrib As System.ComponentModel.DataAnnotations.displayAttribute =
            pd.Attributes(GetType(ComponentModel.DataAnnotations.displayAttribute))
        If Not displayAttrib Is nothing Then
            e.Column.Header = displayAttrib.ShortName
        End If

请注意,属性数组中属性的顺序会发生变化,因此您必须使用GetType(…)而不是数字参数……这样的乐趣!

Application log save debug - how log data is persisted to database table

Application log save debug - how log data is persisted to database table

Created by Jerry Wang, last modified on Jan 05, 2015

Error message 从 application ui 上抛出,
clipboard1
Application 点击 save button 时,call BAL_DB_SAVE 进行 log 的 persistence 处理:
clipboard2
首先将待保存的 log 数据进行压缩:
clipboard3
clipboard4
clipboard5

最后待保存的数据存储在 structure C_S_DB 里:
clipboard6
BALHDR_I 存放的是 header 信息:
clipboard7
BALDAT_I 里存放的是待保存的压缩之后的数据:

clipboard8
clipboard9
clipboard10

在 update function module 里进行 DB update:

clipboard11
clipboard12
OPEN SQL 操作:
clipboard13
clipboard14
clipboard15

更新完毕后,比较 SE16 里和 SLG1 tcode 里的 data:

clipboard16
clipboard17
clipboard18
clipboard19

本文同步分享在 博客 “汪子熙”(CSDN)。
如有侵权,请联系 support@oschina.cn 删除。
本文参与 “OSC 源创计划”,欢迎正在阅读的你也加入,一起分享。

我们今天的关于带有allowCustomSqlDatabase =“true”的ASP.NET SessionState不会调用指定的数据库的分享就到这里,谢谢您的阅读,如果想了解更多关于 How To Set a NLS Session Parameter At Database Or Schema Level For All Connections?、./runInstaller: line 97: /home/oracle/database/install/.oui: Permission denied、.net – 为什么在使用带有AutoGenerateColumns =“True”的DataGrid时会忽略DataAnnotations、Application log save debug - how log data is persisted to database table的相关信息,可以在本站进行搜索。

本文标签: