Add Forms Based user to SharePoint site programatically - sharepoint

I have a web app in SharePoint 2010 whose Authentication mode is Windows. I have extended the web app (Zone:Intranet) where Forms Based Authentication is used.
I have created a sample C# Console application to add the forms based user to the site and it adds the users successfully.
The method:
private void AddFormsBasedUserToSite(){
try
{
string url = "https://appserver:36732";
SPSecurity.RunWithElevatedPrivileges(delegate
{
using (SPSite site = new SPSite(url))
{
using (SPWeb web = site.OpenWeb())
{
string userName = "i:0#.f|aspnetsqlmembershipprovider|forms_user";
web.SiteUsers.Add(userName, null, null, null);
web.Update();
}
}
});
}
catch (Exception e)
{
// Log the exception
}
}
But when the same method is exposed in WCF service (hosted as windows service), and when the client calls this method, it could not add the user. It throws following exception:
The user does not exist or is not unique.
The SharePoint logs is:
Error resolving http://schemas.microsoft.com/sharepoint/2009/08/claims/userlogonname: forms_user from membership provider AspNetSqlMembershipProvider: System.Web.HttpException: Unable to connect to SQL Server database. ---> System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject)
at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject)
at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart)
at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
at System.Web.Management.SqlServices.GetSqlConnection(String server, String user, String password, Boolean trusted, String connectionString) -
-- End of inner exception stack trace ---
at System.Web.Management.SqlServices.GetSqlConnection(String server, String user, String password, Boolean trusted, String connectionString)
at System.Web.Management.SqlServices.SetupApplicationServices(String server, String user, String password, Boolean trusted, String connectionString, String database, String dbFileName, SqlFeatures features, Boolean install)
at System.Web.DataAccess.SqlConnectionHelper.CreateMdfFile(String fullFileName, String dataDir, String connectionString)
at System.Web.DataAccess.SqlConnectionHelper.EnsureSqlExpressDBFile(String connectionString)
at System.Web.DataAccess.SqlConnectionHelper.GetConnection(String connectionString, Boolean revertImpersonation)
at System.Web.Security.SqlMembershipProvider.GetUser(String username, Boolean userIsOnline)
at Microsoft.SharePoint.Utilities.SPMembershipProviderPrincipalResolver.ResolvePrincipal(String input, Boolean inputIsEmailOnly, SPPrincipalType scopes, SPPrincipalSource sources, SPUserCollection usersContainer)
at Microsoft.SharePoint.Administration.Claims.SPFormsClaimProvider.Resolve(SPPrincipalResolver resolver, Boolean inputIsEmailOnly, SPPrincipalSource pricipalSource, SPPrincipalType pricipalType, String resolveInput, List1 resolved)
at Microsoft.SharePoint.Administration.Claims.SPFormsClaimProvider.FillResolve(Uri context, Boolean allZones, String[] entityTypes, SPClaim resolveInput, List1 resolved)
Please help me to figure it out?
Thanks
Prakash

Related

Azure Data Studio - fail to connection to login to server

I have create a container with docker:
mssql is in docker with status up
> docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=Passw0rd!12" -p 1433:1433 -d mcr.microsoft.com/mssql/server:2019-latest
I am trying to connect to SQL server on my network with Azure Data Studio, and I am getting error:
Login failed for user 'sa'.
Details for the error:
Microsoft.Data.SqlClient.SqlException (0x80131904): Login failed for user 'sa'.
at Microsoft.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at Microsoft.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at Microsoft.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at Microsoft.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK)
at Microsoft.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover)
at Microsoft.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout)
at Microsoft.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance)
at Microsoft.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, Boolean applyTransientFaultHandling, String accessToken, DbConnectionPool pool)
at Microsoft.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
at Microsoft.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)
at Microsoft.Data.ProviderBase.DbConnectionFactory.<>c__DisplayClass48_0.<CreateReplaceConnectionContinuation>b__0(Task`1 _)
at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
at Microsoft.SqlTools.ServiceLayer.Connection.ReliableConnection.ReliableSqlConnection.<>c__DisplayClass30_0.<<OpenAsync>b__0>d.MoveNext() in D:\a\_work\1\s\src\Microsoft.SqlTools.ManagedBatchParser\ReliableConnection\ReliableSqlConnection.cs:line 312
--- End of stack trace from previous location ---
at Microsoft.SqlTools.ServiceLayer.Connection.ConnectionService.TryOpenConnection(ConnectionInfo connectionInfo, ConnectParams connectionParams) in D:\a\_work\1\s\src\Microsoft.SqlTools.ServiceLayer\Connection\ConnectionService.cs:line 666
ClientConnectionId:7f82dc23-5d48-4820-9f58-4ccf08416472
Error Number:18456,State:1,Class:14
I have asked and tried to restart the container. I also type the pwd again multiple times and even try to create new container in Docker, but failed.
enter image description here
please help...and thank you.
Try: enter the pwd again and again - create new container - restart container
Expected: it will sucessfully login to localhost server
Result: still failed to log in
The first step is to see what the error logs are in the container,
docker logs [your container id]
If you see an error message like,
Error: The evaluation period has expired.
/opt/mssql/bin/sqlservr: PAL initialization failed. Error: 104
Try to pull the docker image again,
docker pull mcr.microsoft.com/mssql/server:2019-latest

Could not process SSAS cube using C# code

I have a c# code that I am using to refresh the cube on azure analysis service. I am using Microsoft.AnalysisServices.retail.amd64 library to process the cube. The code runs fine and process facts and measures on azure anlysis service without any issue from my LOCAL MACHINE.
Then I uploaded my code to a server machine to run the processing.
When I start the processing job, I get the following error:
[Microsoft.AnalysisServices.ConnectionException: Microsoft.IdentityModel.Clients.ActiveDirectory.ClientAssertionCertificate type missing from ADAL resource.
at Microsoft.AnalysisServices.AdalRuntimeLibrary.LoadAndValidateType(Assembly assembly, String typeName)
at Microsoft.AnalysisServices.AdalRuntimeLibrary.LoadServicePrincipalTypes(Assembly assembly)
at Microsoft.AnalysisServices.AdalRuntimeLibrary..ctor()
at Microsoft.AnalysisServices.AdalRuntimeLibrary.get_Instance()
at Microsoft.AnalysisServices.AadAuthenticator.AcquireToken(String resource, String dataSource, String identityProvider, String tenantId, String userId, String password, Boolean useAdalCache, Boolean useAdTranslation)
at Microsoft.AnalysisServices.XmlaClient.OpenHttpConnection(ConnectionInfo connectionInfo, Boolean& isSessionTokenNeeded)
at Microsoft.AnalysisServices.XmlaClient.OpenConnection(ConnectionInfo connectionInfo, Boolean& isSessionTokenNeeded)
at Microsoft.AnalysisServices.XmlaClient.Connect(ConnectionInfo connectionInfo, Boolean beginSession)
at Microsoft.AnalysisServices.Core.Server.Connect(String connectionString, String sessionId, ObjectExpansion expansionType)
at Microsoft.AnalysisServices.Core.Server.Connect(String connectionString)
exception: [Microsoft.AnalysisServices.ConnectionException: Microsoft.IdentityModel.Clients.ActiveDirectory.ClientAssertionCertificate type missing from ADAL resource.
at Microsoft.AnalysisServices.AdalRuntimeLibrary.LoadAndValidateType(Assembly assembly, String typeName)
at Microsoft.AnalysisServices.AdalRuntimeLibrary.LoadServicePrincipalTypes(Assembly assembly)
at Microsoft.AnalysisServices.AdalRuntimeLibrary..ctor()
at Microsoft.AnalysisServices.AdalRuntimeLibrary.get_Instance()
at Microsoft.AnalysisServices.AadAuthenticator.AcquireToken(String resource, String dataSource, String identityProvider, String tenantId, String userId, String password, Boolean useAdalCache, Boolean useAdTranslation)
at Microsoft.AnalysisServices.XmlaClient.OpenHttpConnection(ConnectionInfo connectionInfo, Boolean& isSessionTokenNeeded)
at Microsoft.AnalysisServices.XmlaClient.OpenConnection(ConnectionInfo connectionInfo, Boolean& isSessionTokenNeeded)
at Microsoft.AnalysisServices.XmlaClient.Connect(ConnectionInfo connectionInfo, Boolean beginSession)
at Microsoft.AnalysisServices.Core.Server.Connect(String connectionString, String sessionId, ObjectExpansion expansionType)
at Microsoft.AnalysisServices.Core.Server.Connect(String connectionString)
Anyone has any idea what could be the issue?

Intermittent IIS/Azure Errors

I have a web app running on an Azure VM. It is single-code base, multiple db's. Based on appsettings in the web.config (basically localhost or production), it knows which database to use.
Just recently I made a simple update and pushed the code to the server. I use git to pull files from the repo to the server, then copy my dll's from my local dev machine to the server. It's not the best, but it's worked for now.
Since this last update, I've been getting intermittent database connection errors (nothing related to the udpates I pushed). Based on the errors I'm receiving, the app is looking for the wrong database (what's set for localhost) instead of using the production databases. It fails on login since the db doesn't exist. I can log in, sometimes customers can't, even at the same time. Then I switch to a new computer and it doesn't work. I've restarted IIS and that's solved it once, but I am totally at a loss about what is going on.
Thoughts:
Could the dll or build be corrupted?
Is something wrong with IIS?
Other Ideas?
Any help, much appreciated!
Scott J.
Edit: It seems only to happen on the login. I changed the login page back to the original. It worked, now it stopped working sometimes again. Very frustrating!
Error Message:
Cannot open database "companyA" requested by the login. The login failed. Login failed for user 'IIS APPPOOL\Production'.
System.Data.SqlClient.SqlException (0x80131904): Cannot open database "companyA" requested by the login. The login failed. Login failed for user 'IIS APPPOOL\Production'. at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover) at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout) at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance) at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions) at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnectionOptions userOptions) at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnectionOptions userOptions) at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) at System.Data.SqlClient.SqlConnection.Open() at PLM.Providers.SqlConnectionHolder.Open(HttpContext context, Boolean revertImpersonate) in C:\Users\Israel\Desktop\ODESK\Scott\PLMMemberhipProvider\SqlConnectionHelper.cs:line 127 at PLM.Providers.SqlConnectionHelper.GetConnection(String connectionString, Boolean revertImpersonation) in C:\Users\Israel\Desktop\ODESK\Scott\PLMMemberhipProvider\SqlConnectionHelper.cs:line 57 at PLM.Providers.SqlMembershipProvider.GetConnectionHolder() in C:\Users\Israel\Desktop\ODESK\Scott\PLMMemberhipProvider\SQLMembershipProvider.cs:line 101 at PLM.Providers.SqlMembershipProvider.GetPasswordWithFormat(String username, Boolean updateLastLoginActivityDate, Int32& status, String& password, Int32& passwordFormat, String& passwordSalt, Int32& failedPasswordAttemptCount, Int32& failedPasswordAnswerAttemptCount, Boolean& isApproved, DateTime& lastLoginDate, DateTime& lastActivityDate) in C:\Users\Israel\Desktop\ODESK\Scott\PLMMemberhipProvider\SQLMembershipProvider.cs:line 1704 at PLM.Providers.SqlMembershipProvider.CheckPassword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved, String& salt, Int32& passwordFormat) in C:\Users\Israel\Desktop\ODESK\Scott\PLMMemberhipProvider\SQLMembershipProvider.cs:line 1562 at PLM.Providers.SqlMembershipProvider.CheckPassword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved) in C:\Users\Israel\Desktop\ODESK\Scott\PLMMemberhipProvider\SQLMembershipProvider.cs:line 1549 at PLM.Providers.SqlMembershipProvider.ValidateUser(String username, String password) in C:\Users\Israel\Desktop\ODESK\Scott\PLMMemberhipProvider\SQLMembershipProvider.cs:line 856 at System.Web.UI.WebControls.Login.AuthenticateUsingMembershipProvider(AuthenticateEventArgs e) at System.Web.UI.WebControls.Login.OnAuthenticate(AuthenticateEventArgs e) at System.Web.UI.WebControls.Login.AttemptLogin() at System.Web.UI.WebControls.Login.OnBubbleEvent(Object source, EventArgs e) at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) at System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) ClientConnectionId:5257f0df-46c9-4faa-bfea-1db4daf509b3
What kind of database are you logging into? I'm hoping that your data is stored in SQL Azure or Azure Storage.
If your production database is created within the worker role, note that your worker role will be periodically re-started by Microsoft whenever your worker's OS needs to be updated, etc. and any locally created files (inc. DB files) will be deleted when the VM reboots.

Mystery of the missing SQL Server transaction log (.ldf) file

I have just finished development of a C# 2010 windows desktop application that uses SQL Server 2005 Express.
I gave it to a colleague to test on his Windows 7 (64bit) laptop.
The program ran as expected on day one, connecting the database to the local instance of SQL Server Express when it made the first db call with a connection string like this:
Server=.\SQLExpress;AttachDbFilename=|DataDirectory|MyDB.mdf;Database=MyDB;integrated security=true;user instance=true;
The next day when he ran the program it failed with the following exception:
System.Data.SqlClient.SqlException (0x80131904): Cannot open database "MyDB" requested by the login. The login failed.
Login failed for user 'Tack-PC\Tack'.
File activation failure. The physical file name "C:\Program Files (x86)\MyCo\MyApp\MyDB_log.LDF" may be incorrect.
The log cannot be rebuilt when the primary file is read-only.
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException
exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream,
BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject
stateObj)
at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean
enlistOK)
at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo
serverInfo, String newPassword, Boolean ignoreSniOpenTimeout,
TimeoutTimer timeout, SqlConnection owningObject)
at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo
serverInfo, String newPassword, Boolean redirectedUserInstance,
SqlConnection owningObject, SqlConnectionString connectionOptions,
TimeoutTimer timeout)
at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection
owningObject, TimeoutTimer timeout, SqlConnectionString
connectionOptions, String newPassword, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity
identity, SqlConnectionString connectionOptions, Object providerInfo,
String newPassword, SqlConnection owningObject, Boolean
redirectedUserInstance)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions
options, Object poolGroupProviderInfo, DbConnectionPool pool,
DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection
owningConnection, DbConnectionPool pool, DbConnectionOptions options)
at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection
owningObject)
at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection
owningObject)
at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection
owningObject)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection
owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection
outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
at MyApp.DataGateway.getTable(String sql)
at MyApp.frmMain.InitialiseList()
at MyApp.frmMain.frmMain_Load(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.FormsControl.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
I also noticed the log file (.ldf) that SQL Server creates after attaching the DB for the first time was missing.
Does anyone have any idea why or how it could have disappeared?
The first thing I did on reading the exception was (a bit heavy handed I know, but I just wanted to get him back up and running while he could still dedicate time to testing for me and I could research the problem in parallel) to give full permissions to the working folder for all users, so it could at least create a new log file.
This resulted in the program successfully running, but all data he entered on day one was not gone.
Can anybody shed light on this situation for me?
Why did the log file vanish?
And while we are at it, why was all the data lost? Wouldn't it be in the mdf file, which was still there?

Deployment problems of asp.net 3.5 in iis 5.1

i have microsoft.net 3.5 application and have IIS5.1,,for deploying website
do i need to do any thing aother than this
1.In IIS i created virtual directory named SPA and i browsed in to the location
where my project is lacated and i added entire project file there( Do i need to add
only bin file and login page or i need to add all pages???)
2.In asp.net folder i selected tab version 2.0,,
3.when i browsed i can see all pages when i click login.aspx i am getting
this error
[SqlException (0x80131904): User does not have permission to perform this action.]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +821651
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +186
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1932
System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) +33
System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) +172
System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +381
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +181
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +173
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +133
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +30
System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +424
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66
System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +494
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +82
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105
System.Data.SqlClient.SqlConnection.Open() +111
ChatTool.LoginForm.Page_Load(Object sender, EventArgs e) in D:\Chat tool_Ameya\ProjectCode\Unisys Project Testing\Unisys Project\Login.aspx.cs:25
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +33
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436
There are a number of issues of trying to use SQLExpress for deployed web applications.
Here's a link for working with SQL Server Express and ASP.NET
http://msdn.microsoft.com/en-us/library/ms247257.aspx

Resources