开发者

Invalid object name 'ASPState.dbo.ASPStateTempApplications' - Exception after renaming the ASPState Database

开发者_开发知识库I have created new session database using the command (aspnet_regsql.exe -S -E -ssadd -sstype p) and it created DB called ASPState. Then I renamed it to something like E_ASPStateDB. I have configured the correct DB name in the sessionState connection string. But still it throws the exception Invalid object name 'ASPState.dbo.ASPStateTempApplications'

What i need to do, so that it will use the new database name?


I ran this on the db server that the site was connecting to and it solved it immediately.

USE [ASPState]
GO

DECLARE @return_value int

EXEC    @return_value = [dbo].[CreateTempTables]

SELECT  'Return Value' = @return_value

GO


Since you renamed the DB you will have to regenerate the ASPnet session tables. Below is the solution to it.

To Remove, use following command: [open visual studion command prompt]

aspnet_regsql -ssremove -S [SERVER] -U [USER] -P [PWD] -d [DATABASE] -sstype c

Then add them again by following command

aspnet_regsql -ssadd -S [SERVER] -U [USER] -P [PWD] -d [DATABASE] -sstype c


You must modify the stored procedures because they invoke the tables with the database name and schema, as follows:

[ASPState].dbo.ASPStateTempApplications

you have to change it for

[E_ASPStateDB].dbo.ASPStateTempApplications


once you have registered a DB name using aspnet_regsql, you shall have to use the name you registered with. There is no point really to change the name afterwards. If you really want to use a name like E_ASPStateDB, why not delete the registration of ASPState first and then re-registering with the name E_ASPStateDB. It shall make your life easier

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜