We have a .NET 4.5 Azure Webrole with Azure (colocated) Caching enabled. We use Entity Framework 5.0 talking to an Azure SQL database.
We did some cleanup on our staging/testing and I noticed that the entity framework edmx file complains that
Entity type 'AspNet_SqlCacheTablesForChangeNotification' is not mapped.
We had also briefly experimented with SQL Sync. We don't know if it's SQL Sync or Azure caching that added that table (and any other elements?) to our database
What installs and uses AspNet_SqlCacheTablesForChangeNotification? Is it safe to remove it? Finally, any extra items that ride along with that table that we should cleanup?
See this article on MSDN on setting up SQL Server Cache Dependency.
This is set up using the aspnet_regsql.exe tool that comes with .Net
You can disable this using aspnet_regsql -S localhost -U sa -P wrox -d Northwind -dd however I am not sure if this removes the associated configuration tables (Worth a shot). The tool may not work with SQL Azure in which case you may have to manually remove the table.
It's worth checking your web.config is not set up to expect Cache Dependencies by checking for this:
<system.web>
<caching>
<sqlCacheDependency enabled="true">
<databases>
<add name="Northwind" connectionStringName="AppConnectionString1"
pollTime="500" />
</databases>
</sqlCacheDependency>
</caching>
</system.web>
Related
I want to know if I have sqlstate session then do I need to create database for aspnetdb in the already (i.e. sampledb) existed database or I should have to create it separately. Suppose if I had create it in sampledb which is already existed then what connection-string path should I have to give in web.config and what changes would I have to make it on the time of deployment of the internet.
Please give me answer because there is lots of questions arising in my mind.
You should create a new database for the session state.
Configuring SQL Server session state is really simple and requires two simple steps:
Install ASPState database on your SQL server.
1.1 Open the command prompt and navigate to the folder where .NET Framework is installed on your machine e.g. C:\Windows\Microsoft.NET\Framework\v4.0.30319
1.2 Run the following command in the command prompt - aspnet_regsql.exe -S SampleSqlServer -E -ssadd -sstype p
Configure SQL server session state in the Web.config file to point to the ASPState database on your server.
Web.config:
<configuration>
<system.web>
<sessionState mode="SQLServer"
sqlConnectionString="Integrated Security=SSPI;data
source=SampleSqlServer;" />
</system.web>
</configuration>
Complete tutorial can be found here - Session-State Modes
I'm lost with this, especially after following the guide on how to configure this.
This is how the webdeploy is configured in the iis host config:
<wdeploy>
<backup turnedOn="true" enabled="true"
numberOfBackups="4"
backupPath="C:\inetpub\Backups\{siteName}"
continueSyncOnBackupFailure="false">
<excludedProviders>
<provider name="dbMySql" />
<provider name="dbFullSql" />
</excludedProviders>
</backup>
</wdeploy>
As per the documentation:
What a Backup Contains (documentation)
"...You can change this default behavior by modifying the ExcludedProviders backup setting, or by specifying skip rules before doing a publish."
Web Deploy providers (documentation)
"Web Deploy dbFullSql Provider" The dbFullSql provider enables first-time publishing of databases from a local SQL Server development database to a remotely hosted SQL Server database.
When I go to deploy I get the following message:
Error: BACKUP_FAILED - Skipping backup because it failed due to an unknown reason. For more information, contact your server administrator.
Error: You cannot create or restore a backup of multiple databases in a single sync.
Error count: 1.
My questions/issues are why is the backup attempting to backup more than one database and why would this be even attempting to backup the databases when the provider has been excluded in the config.
Help!
Im running ravendb under shared hosting under IIS.
I have set up api key which enables me to call my my ravendb server from code. This all works fine.
The problem is i cant seem to figure out how to make this work with the Ravendb studio. As i see it the only option is to set <add key="Raven/AnonymousAccess" value="Admin"/> the i need to change the server, eg add a database and back to <add key="Raven/AnonymousAccess" value="None"/> when im done.
Is there anyway to use the same oauth api key to access the studio as im using in my code?
If not, is there any work around you could surgest?
Thanks
You can use the same Api Key also to get access for a specific database in the studio:
https://example.com/raven/studio.html#/home?api-key={api-kay}&database={database-name}
I've got an application running on ASP.NET MVC 3 with Entity Framework Code First. In development I was using a SQL Compact database, however upon moving this to my virtual server, I am attempting to target SQL Express.
There were initially issues to do with a "CREATE DATABASE in master" error, which I got around by extracting the model from the SQL Compact database into an SQL script and executing that on the server to create the DB.
I have created a new connection string to point at the SQL Express instance, which uses the EF format:
<add name="LouiseClarkEntities" connectionString="metadata=res://*/Models.LouiseClark.csdl|res://*/Models.LouiseClark.ssdl|res://*/Models.LouiseClark.msl;provider=System.Data.EntityClient;provider connection string="Data Source=.\SQLEXPRESS; Initial Catalog=LouiseClark; User ID=<username>; Password=<password>"" providerName="System.Data.EntityClient" />
The error I am now getting when navigating to a page that uses the DB, is:
Unable to find the requested .Net Framework Data Provider. It may not be installed.
I have installed Entity Framework 4.1 on the server to try and see if this would solve the issue, but it didn't seem to do much good.
Snippet from the stack trace on error page:
[ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed.]
System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName) +1420567
System.Data.EntityClient.EntityConnection.GetFactory(String providerString) +35
[ArgumentException: The specified store provider cannot be found in the configuration, or is not valid.]
Any help would be appreciated, as this has been bugging me for days now!
Thanks,
Chris
Use the normal connection string with code first.
<add name="LouiseClarkEntities" connectionString="Data Source=.\SQLEXPRESS; Initial Catalog=LouiseClark; User ID=<username>; Password=<password>" providerName="System.Data.SqlClient" />
On your second problem, and partly the cause of the first too...
what you did wrong is which I got around by extracting the model from the SQL Compact database into an SQL script and executing that on the server to create the DB.
You should use migration scripts for that - and use in PM console then Update-Database -Script to dump out what you need - then deploy that to the server Database.
Problem is that there are CF has its own table and data that needs to be initialized properly. If that doesn't match you'll end up with something like that.
I started building my site in WebMatrix and then switched to using VS2010 so I could have better Intellisense and debugging. I've been loading WebMatrix to deploy and it's been working fine.
However, loading WebMatrix is a PITA and I actually want more flexibility over the web deployment process.
So I started learning about msdeploy.exe and how to use it. I was able to successfully get the site to sync as I wanted with the following command line:
msdeploy.exe
-verb:sync
-dest:iisApp=MySite,wmsvc=www.mysite.com,username=administrator,password=blahblahblah
-allowUntrusted
-skip:absolutePath=webdeploy.cmd
-skip:absolutePath=web.config
-skip:objectName=dirPath,absolutePath="App_Data"
-skip:objectName=dirPath,absolutePath="bin"
-skip:absolutePath=vwd.webinfo
-source:iisApp="C:\Users\charlie\Documents\Visual Studio 2010\WebSites\MySite"
I had to use -allowTrusted because the cert on the server uses a differnt host name than www. No biggie. I have some -skips for stuff I don't want to write to the dest as well.
It all works great.
I use SQL Server (Express) on my host (a WebMatrix AMI on AWS).
I want to have the ability to push my database to the host as well. I am trying to use the following msdeploy commmand:
msdeploy.exe
-verb:sync
-source:dbFullSql="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=C:....\MySite.mdf;User instance=true"
-dest:dbFullSql="Server=www.mysite.com\SQLEXPRESS;Initial Catalog=webmatrix_db;Uid=webmatrix_user;Pwd=<pwd>"
This gives me
Error: The database 'webmatrix_db' could not be created.
Error: A network-related or instance-specific error occurred while establishing aa
connection to SQL Server. The server was not found or was not accessible. ...
I think my problem is the connection string. I copied Server=".\SQLEXPRESS;Initial Catalog=webmatrix_db;Uid=webmatrix_user;Pwd=<pwd> from the WebMatrix UI and pre-pended it with www.mysite.com thinking it needed my hostname somewhere.
Obviously this is not correct and I can't find any examples of connection strings that work either.
Note that SQL is not exposed directly by this server. I assume WebMatrix's invocation of msdeploy is connecting using my admin credentials (not the SQL credentials) first and then msdeploy invokes the SQL commands on the remote host. I need something like the ...wmsvc=www.mysite.com,username=administrator,password=blahblahblah in the -dest option of the first example I gave above.
It would be awesome if I could see a log of how WebMatrix was invoking msdeploy.
What is the correct msdeploy command to do what I want?
[UPDATE - ANSWER]
One of the best things about StackOverflow, is that posting a question really makes you think about what you are doing. Shortly after I posted the above, I realized the wmsvc=www.mysite.com,username=administrator,password=blahblahblah parameter in the -dest parameter was the key. The question became how to correctly add it to my specific example.
This msdeploy command line now connects correctly:
msdeploy.exe -verb:sync -source:dbFullSql="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=C:\Users\charlie\Documents\Visual Studio 2010\WebSites\Fiinom\App_Data\MySite.mdf;User instance=true" -dest:dbFullSql="Server=.\SQLEXPRESS;Initial Catalog=webmatrix_db;Uid=webmatrix_user; Pwd=rI2vP3rK6hV8nN8",wmsvc=www.mysite.com,username=administrator,password=blahblahblah -allowUntrusted
Now that msdeploy is connecting successfully and executing commands, I need to figure out how to make it actually merge the database. Right now it's giving me an error that a table already exists and can't create it...
This is related to your side comment on merging the database...
Currently Web Deploy does not have any provider that supports database merges - the dbFullSql provider uses SQL Server Management Objects ("SMO") to script out the db contents and we then apply it on the other side. Effectively Web Deploy thus will only overwrite the destination db with the source db.
If you are okay with that as a "merge" you can get around that table already exists error by using SMO scripting options - this is what WebMatrix does to make the db publishing/downloading work. To your source just add:
,scriptDropsFirst=true
(this scripts out drops for all the objects in your source database so that if they exist on the destination they will get dropped and won't block you)
You might also need:
,copyAllUsers=false
(if you aren't a sysadmin on the remote SQL database, chances are you won't be able to create logins, which are a server-level action. Typically if you don't use this setting, you'll get an error about creating a login, or login doesn't exist, because SMO scripts our your database user as "for LOGIN " and that login doesn't exist on the server)
Hope that helps!
Kristina