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}
Related
I have made application ASP.NET C# and my connection string is as follows:
<add name="ASPNETDB" connectionString="Server=tcp:MYDATA.database.windows.net,1433;Database=MYDATA;User ID=MYDATA;Password=MYDATA;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;" providerName="System.Data.SqlClient" />
Now it doesn't work at all, I mean I can't connect to my SQL server on Azure at all. When I want to login nothing happens, when I want to register nothing happens too. I get exception when I press to update DB, ie Publish->Settings-> Check box "Update database" Configure database updates . It seems to me that it doesn't work at all. The exception is of following type:
Error 22 Web deployment task failed. (Could not deploy package.
Unable to connect to target server.
Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_EXECUTING_METHOD.) 0 0
What should I do? Please help?
I would recommend logging into the azure management portal and re downloading the publish profile for the application. If you are not working using a publish profile , then at least re download the connection string that is setup for the app and the DB. while in there check that the application (web site or VM) is up and running, and that the database it is connected to is also up and running.
I had to set firewall rule 0.0.0.0 to 255.255.255.255. Even though my firewall rule was set for my address, somehow it didn't register, because communication was relying to my website-DB and ip address of my website wasn't included there too. So I put rule as said before and now it works like a charm. :-)
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>
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'm trying to ensure my ASP.NET 4.0 application runs under an administritive account. I've got this in my web.config:
<identity impersonate="true" userName="Admin" password="myadminpassword"/>
'Admin' is the local administrator account on my server (Windows Server 2003 SP2, running IIS6).
But, 'SYSTEM' still gets returned from Environment.UserName when I run it.
Am I doing something incorrectly, is there anyway to verify that the impersonation is actually working? This is possibly the cause of a wider issue I'm seeing, so I want to ensure that I'm using impersonation correctly.
Update
I've also tried outputting
System.Security.Principal.WindowsIdentity.GetCurrent().Name
But, this also returns 'NT AUTHORITY\SYSTEM' as the username so it looks like impersonation isn't working or something is over-riding my web.config?
Thanks.
As this is an internally facing application, I just set the Identity of the Application Pool to the account I want to run under - this resolved my issues.
I've created a custom Web Part for SharePoint that interacts with SQL.
Everything worked fine on my DEV server.
After I moved the WebPart to the client's server I started having problems.
I get Error Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection when I'm trying to open the WebPart.
I've searched for solution for a few hours by now and everything I have found doesn't seem to work in my case.
This is how my connection string looks like:
<add name="MyDataEntities" connectionString="metadata=res://*/MyDataModel.csdl|res://*/MyDataModel.ssdl|res://*/MyDataModel.msl;
provider=System.Data.SqlClient;provider connection string="Data Source=ServerName;Initial Catalog=DBName;
Trusted_Connection=yes;Integrated Security=True;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" />
The SharePoint Web App with the web part and SQL DB are on two different machines.
Here's what I've tried:
1). Made sure SQL uses Mixed mode authentication
2). Made sure the account I'm using has rights to access SQL
3). Tried replacing Integrated Security=True; in the connection string with the User ID = UserID; Password=Password; where UserID and Password were the account IIS is running under.
I ran profiler while clicking on the link and it looks like the app is not using the account’s credentials and is trying to log in anonymously.
Any help is appreciated, I'm desperate because this must be up and running by tomorrow.
Thanks in advance!
Try SPSecurity.RunWithElevatedPrivileges: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spsecurity.runwithelevatedprivileges.aspx
This method will run code as the ASP.Net application pool identity. Wrap your database calls with it.