I try to run my asp net application in godaddy webserver and get error:
Exception Details: System.ArgumentException: Invalid value for key ‘attachdbfilename’.
My connection string:
<connectionStrings>
<remove name=”LocalSqlServer”/>
<add name=”LocalSqlServer” connectionString=”Data Source=(LocalDB)v11.0;Integrated Security=True;AttachDbFilename=|DataDirectory|Database.mdf” providerName=”System.Data.SqlClient”/>
</connectionStrings>
Any ideas how could I fix this? I dont have this error on my pc.
Ooops, I had the same problem, in my case i did not have LocalDB installed, so how about you check for that!!
Related
My configuration is as follows:
<connectionStrings>
<add name="ADService" connectionString="LDAP://myserver.com:636/ou=people,dc=mysite,dc=com" />
</connectionStrings>
<membership defaultProvider="AspNetActiveDirectoryMembershipProvider">
<providers>
<add name="AspNetActiveDirectoryMembershipProvider" type="System.Web.Security.ActiveDirectoryMembershipProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="ADService"
attributeMapUsername="uid"
attributeMapEmail="mail"
connectionProtection="Secure"
/>
I have verified the connection string it works and returns the objects with uid=xxx . But with ASP.net I am recieving error
Parser Error Message: An invalid dn syntax has been specified.
My Ldap server support anonymous binding. What am i doing wrong ? The server I am connecting to is not AD but an OpenLDAP 3.0 .
When do you get the error? i.e. What part of your code? Invalid dn syntax can be thrown for a couple of reasons: like problem with the connection string or invalid characters like comma in a property while you are retrieving it.
Btw: attributeMapUsername="uid"? Are you sure about this? Why not attributeMapUsername="userPrincipalName"? or attributeMapUsername="sAMAccountName"?
It was an LDAP configuration issue. It required an SSL connection which I was not doing. It needed AuthenticationTypes.SecureSocketsLayer | AuthenticationTypes.FastBind in the connection option.
On the other note, this built in api only works for AD so I had to write my own.
I am trying to use the database send by my friend. He has created it using Sql Server Management Studio. While including the .mdf file, I am getting an error message (I have mentioned the error at the end of the answer).
I think it is because of the difference in the connection strings. I am new to .NET so I just changed the name in the connection string,
From,
<add name="ApplicationServices" connectionString="Data Source=sheroz;Initial Catalog=FLEXIFORMDB;integrated security=SSPI"/>
</connectionStrings>
To,
<add name="ApplicationServices" connectionString="Data Source=Fahad-PC\Fahad;Initial Catalog=FLEXIFORMDB;integrated security=SSPI"/>
</connectionStrings>
Please help me out to make it work. Thanks in advance.
Error
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
------------------------------
Program Location:
at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType)
at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(StringCollection sqlCommands, ExecutionTypes executionType)
at Microsoft.SqlServer.Management.Smo.ExecutionManager.ExecuteNonQuery(StringCollection queries)
at Microsoft.SqlServer.Management.Smo.Server.AttachDatabaseWorker(String name, StringCollection files, String owner, AttachOptions attachOptions)
at Microsoft.SqlServer.Management.Smo.Server.AttachDatabase(String name, StringCollection files)
===================================
Unable to open the physical file "D:\FlexiFormWF\FlexiFormWF\FlexiFormDB.mdf". Operating system error 5: "5(Access is denied.)". (.Net SqlClient Data Provider)
------------------------------
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.00.1600&EvtSrc=MSSQLServer&EvtID=5120&LinkId=20476
------------------------------
Server Name: FAHAD-PC\MSSQL
Error Number: 5120
I think you have something with your permissions. At least, this quote from your error message suggests that:
Operating system error 5: "5(Access is denied.)"
C:\WINDOWS\Microsoft.NET\Framework\v2.0>aspnet_regiis.exe -pef connection1
"C:\Website1" -prov "RSAProtectedConfigurationProvider"
Encrypting configuration section...
The configuration section 'connection1' was not found.
Failed!
Above is screen shot of error that i getting while encrypting connection string
The web config file is as,
<configuration>
<connectionStrings>
<add name="connection1" connectionString="Data Source=inpun2-s4pvh8bs;uid=cusa;pwd=csusa;Initial Catalog=ChemTrack"/>
</connectionStrings>
</configuration>
Any idea about this?
I am running this from visual studio 2010 command prompt.
also a/c that i am using is member of administrator group.
Try this instead :
aspnet_regiis.exe -pef "connectionStrings" "C:\Website1"
For more : http://www.codeproject.com/Tips/304638/Encrypt-or-Decrypt-Connection-Strings-in-web-confi
I am trying to pre-generate view metadata for my Entity Framework project and have run across a problem on the last step when using this resource:
http://msdn.microsoft.com/en-us/library/bb896240.aspx
Everything else is compiling great, but I'm getting an error when I run my application, and I suspect it's due to a problem with the final step, 're-adding mapping and model files as embedded resources for ASP.NET projects.'
I'm receiving 'Unable to load the specified metadata resource.' and my connection string is as follows:
<add name="myEntities"
connectionString="metadata=
.\DataStructure.csdl|
.\DataStructure.ssdl|
.\DataStructure.msl;provider=System.Data.SqlClient;provider
connection string="Data Source=x;Initial Catalog=x;Persist Security Info=True;User ID=x;Password=x;MultipleActiveResultSets=True""
providerName="System.Data.EntityClient" />
It is suggested in the document that my connection string file should include the following but haven't been able to get it right in any configuration:
Metadata=res://<assemblyFullName>/<resourceName>;
Metadata=res://*/<resourceName>;
Metadata=res://*;
Assuming my assembly name is DataStructure.EF, how should my string be constructed?
http://msdn.microsoft.com/en-us/library/cc716756.aspx
<connectionStrings>
<add name="AdventureWorksEntities"
connectionString="metadata=.\AdventureWorks.csdl|.\AdventureWorks.ssdl|.\AdventureWorks.msl;
provider=System.Data.SqlClient;provider connection string='Data Source=localhost;
Initial Catalog=AdventureWorks;Integrated Security=True;Connection Timeout=60;
multipleactiveresultsets=true'" providerName="System.Data.EntityClient" />
</connectionStrings>
I compiled a full guide for anybody else having problems and published it here: http://kewney.com/posts/software-development/pre-generating-views-to-improve-query-performance-in-aspnet-mvc-3-entity-framework
Parser Error Message: An attempt to
attach an auto-named database for file
D:\Projects\Damnation\Damnation.Website\Damnation.Website.Tracker\BugNET_WAP\App_Data\aspnetdb.mdf
failed. A database with the same name
exists, or specified file cannot be
opened, or it is located on UNC share.
Why could this be happening? My connection string doesn't use |DataDirectory|, it is:
<connectionStrings>
<add name="BugNET" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=dnmain;Integrated Security=True;"/>
</connectionStrings>
I get this error when I try to load default.aspx, after installing BugNET.
Apparently, and certainly for some obscure reason. There is a mistery connection string coming from... nowhere.
Problem solved adding a <clear/> tag.
<connectionStrings>
<clear/>
<add name="BugNET" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=dnmain;Integrated Security=True;"/>
</connectionStrings>
file
D:\Projects\Damnation\Damnation.Website\Damnation.Website.Tracker\BugNET_WAP\App_Data**aspnetdb.mdf**
failed.
This is the ASP.NET standard membership system here - not your "regular" database. There must be a second connection string somewhere that references this aspnetdb.mdf and tries to attach it from a file.
Search your solution for this file name - it must be somewhere!