After creating filetable I've got a shared folder
\\<my domain>\mssqlserver\<filestream directory>\<my table>
I've made all nesessary settings in SqlServer Configuration manager to make it available and added couple of files with database stored proc.
I made virtual folder for my web site
http://localhost/<my ewb site>/<virtual folder>/
referencing shared table folder.
When I try to get file from folder I get en error:
HTTP 500.19 - Internal Server Error
Code 0x80070032
I found something in answer of this question
Access Denied when inserting file into Sql Server 2012 FileTable using File.CreateFile in ASP.NET website
But it's only a database part of configuring.
I don't understand how to configure IIS and virtual folder to grant access to shared folder.
Not sure if this is relevant to your situation, but I came across the same problem. 2 out of 3 sites that I setup worked fine with the UNC path virtual directory pointing to the SQL filetable share, but the 3rd site got the error above. The reason was because this site was had both IIS and SQL on the same server, and using the server name in the UNC path was causing a reparse and checking for directory change notifications, which mentioned in the comments above aren't supported by SQL. So I changed the UNC path to use localhost instead of the server name and it worked! So, instead of:
\\<my domain>\mssqlserver\<filestream directory>\<my table>
use:
\\localhost\mssqlserver\<filestream directory>\<my table>
Related
I am getting following error on BULK INSERT after the file location was changed to remote share. Before it used to be a shared folder in local drive and we never ran into this issue. I am running this BULK INSERT from my local PC connecting to SQL Server via SSMS.
I have made sure both SQL server and file permissions are in place.
Before when I ran this command from SSMS, it was \\SQLServer\FTP location which was a shared folder in local drive in that SQL Server but now I changed the file location to a network share \\Fileshare\FTP and have the above error but both SQL service account (domain account) and me (domain account) have elevated permission on that new location.
Any help or suggestions!!
Thanks,
I can identify three circumstances that might generate this issue:
From the SQLAuthority Blog, full detail on a related backup issue where there is a cross-domain link (in this case, from a workgroup to a full domain).
There are also two other possible answers in the question Cannot bulk load because the file could not be opened. Operating system error code 1326(Logon failure: unknown user name or bad password.) here on StackOverflow. We can discount the first one (login permissions) because you stated that you had permissions, but the other solution (I fixed it by adding the SQL Server port number to the connection string in SSIS, forcing SSIS to access SQL Server through TCP/IP instead of Named Pipes.) could apply. Try forcing a connection to the server using TCP/IP.
All of these issues appear to be related to having an attempt at cross-domain communication. If this is the issue with you, one or more of these fixes should be applicable to your issue.
-
It finally worked....
I had to configure Kerberos Authentication following the guide from this link https://thesqldude.com/2011/12/30/how-to-sql-server-bulk-insert-with-constrained-delegation-access-is-denied/.
Of course, I had to make adjustments to suit our environment and had to involve Active Directory Admin for creating SPNs and enabling DELEGATION properties.
Thanks.
I created a virtual directory for my dnn site which uses new database steps are as follows
right click on site -> add virtual directory
copied all file from dnn site to virtual directory folder
runs the site it woks file
create backup of old sql database (which are used by dnn site)
create new database in sql and restore old database backup on it
changed the connection string of web.config file
runs the site but its not using new database (using old database)
I want to know what changes I need to do my virtual directory so that it uses new database please guide me
Thanks
If you are running it in a sub-directory or new virtual directory make sure your PortalAlias table in your SQL database has the proper URL in it. There are two spots in your web.config file that the database needs to be changed. That is the only place that your database connections will be. Recycle your application pool / restart IIS / restart your DNN application in the HOST menu just to make sure it is all cleared up and it is referencing your web.config file (even though just saving the web.config with different info should have been sufficient)
But the web.config file is the only place the database connections would be, if you have a web.config file higher up (above your virtual directory) it could be affecting your web.config in a sub directory.
I'm transitioning email services in an web (mvc3) application from .Net to sql Database Mail. Some of the content we want to send as attachments has been uploaded to a sql FileTable. When I use the UNC path for the attachment (#file_attachments=), I get this error:
Msg 22051, Level 16, State 1, Line 0 Attachment file
\\computername\mssqlserver\foldername\foldername\DE107D2C-B945-4F1E-A4B9-4B398C9DE758.jpg)
is invalid.
I can open the file directly using the same path, and when I copy the file to a local folder, the file attaches fine. I suspect that the issue is folder permission for the FileTable directory. But I can't find any hooks to set the rights for that folder.
I'm running the EXECUTE msdb.dbo.sp_send_dbmail locally in SSMS (local sql instance) using windows authentication.
Any suggestions would be much appreciated.
This behavior was validated in the Microsoft Database Engine forum and I submitted feedback: https://connect.microsoft.com/SQLServer/feedback/details/756716/sql-server-database-mail-attachments-from-filetable-msg-22051-file-is-invalid
Note that the error code I had in this title should be 22051 and not 22015.
In the mean time, I'm using a work around of copying the files using the sql command shell to another local folder, and using that path for the attachment
Thanks.
share your attachement folder to Network service user in which attchment file exist.
and give attachemnt file path like \\ip_addres\filefolder\abc.pdf to send_dbmail stored procedure.
This will work if file and sql server are on different machines
I'm learning ASP.NET MVC 3 with Entity Framework Code First. I'm following a tutorial and I downloaded the corresponding solution for testing on my local machine. Now, something I didn't understand very well is about the automatic creation of the database (if this one didn't exist yet on disk). The very first time I run the application, the database is created for me. That's ok.
Here is the section in Web.config
<add name="BlogContext"
connectionString="Data Source=.\SQL2008;Initial Catalog=CodeFirstMVC.mdf;Integrated Security=SSPI"
providerName="System.Data.SqlClient" />
But I have two problems:
1st. For testing purpose, I deleted the database on disk and run again the solution. I thought that the database would be automatically created but I was wrong: I got the error message below:
{"Unable to open the physical file \"c:\\Program Files\\Microsoft SQL Server\\MSSQL10.SQL2008\\MSSQL\\DATA\\CodeFirstMVC.mdf.mdf\". Operating system error 2: \"2(failed to retrieve text for this error. Reason: 15105)\".\r\nCannot open database \"CodeFirstMVC.mdf\" requested by the login. The login failed.\r\nLogin failed for user 'sa'.\r\nFile activation failure. The physical file name \"c:\\Program Files\\Microsoft SQL Server\\MSSQL10.SQL2008\\MSSQL\\DATA\\CodeFirstMVC.mdf_log.LDF\" may be incorrect."}
I noticed that if I changed the file name in my Web.config then the database is again successfully created. Can you explain me? Why do I have to change the database name to get it running again?
2nd. The database is created in the folder located in C:\Program Files\Microsoft SQL Server\MSSQL10.SQL2008\MSSQL\DATA. I would like to store my database in the App_Data directory. How can I proceed?
Initial catalog is not path to file. It is the name of database. AttachDbFilename is used to specify the file so your connection string should look like:
Data Source=.\SQL2008;Initial Catalog=CodeFirstMVC;AttachDbFilename=|DataDirectory|CodeFirstMVC.mdf;Integrated Security=SSPI
Where |DataDirectory| instructs SQL server to use local application data directory instead of global SQL Server data directory. Local data directory for web application is App_Data.
Edit:
I just noticed that you are probably using full SQL server instead of SQL server express. As I know creating database in App_Data automatically is feature of SQL server express. That also explains first error because SQL server created database called CodeFirstMVC.mdf and stored the database in its global data directory within CodeFirstMVC.mdf.mdf file and transaction log in CodeFirstMVC.mdf.ldf file. It also registered that database internally. By deleting files you didn't remove database from SQL server. You just break its functionality but SQL server still believes that the database exists. That is also reason why you have to change the name to make it work.
I'm using the Database Publishing Wizard in VS2008 to push changes to my hosting provider. It doesn't look like those settings go with the project (which seems a little silly to me), but rather they go with the machine.
On each new machine that I'd like to publish from I need to go through the process of digging up my database settings.
Is there a way to backup/export/save these settings to a file?
If so, what is it?
Hmmm ... it appears that the publishing wizard uses 2 config files for it's application configuration:
The Publish Database Wizard uses the
files user.config and hoster.config to
store configuration information. The
directory in which these files are
stored must have the appropriate NTFS
file system permissions set. These
files contain user names and encrypted
passwords. The passwords are encrypted
by using DPAPI.
user.config File
This file stores persisted host and
configuration settings for the Publish
Database Wizard. The user.config file
is located at %SystemDrive%\Documents
and Settings\%Username%\Application
Data\Microsoft\Microsoft SQL
Server\90\Tools\Publishing
Wizard\user.config.
hoster.config File
This file stores options about Web
service addresses, user names, and
databases for shared hosting
providers. The hoster.config file is
located at %SystemDrive%\Documents and
Settings\%Username%\Application
Data\Microsoft\Microsoft SQL
Server\90\Tools\Publishing
Wizard\hoster.config.
I'm trying to access these files in Vista (with VS2008 and SQL Express installed) and striking out. I'll keep you posted.
Update: Looks like I didn't have the Publishing Wizard installed after all. After grabbing the version for VS2008 here, and then installing (and don't worry -- you won't see any indication it's getting installed, but it does).... and THEN setting up my first database using the wizard, it looks like there are indeed some settings stored uder the 'Application Data' directory listed above. However, it looks like it's just a user.config, and then an XML file for each database configured. I believe you can backup each of these files for later use.