LINQ to SQL的插入不工作部署服务器(IIS) [英] linq to sql Insert not working on deployed server(IIS)
问题描述
标题本身就说明了,
db.ExecuteCommand("INSERT INTO tCSVFile(fileName, fileContent, mimetype, timeCreated) VALUES({0}, {1}, {2}, {3})", filename, EncodeTo64(CreateCSVFile(header, rows)), "text/csv", DateTime.Now );
这个作品从虚拟服务器不错,但在IIS上插入导致什么情况发生。
this works fine from the virtual server but on iis inserting causes nothing to happen.
也试过这个..
tCSVFile c = new tCSVFile
{
fileContent = EncodeTo64(CreateCSVFile(header, rows)),
fileName = filename,
mimetype = "text/csv",
timeCreated = DateTime.Now
};
db.tCSVFiles.InsertOnSubmit(c);
db.SubmitChanges();
再次工作在虚拟服务器上,但在IIS上没有运气。任何帮助将大大AP preciated,因为我已经看过网络上和还没有发现使用的东西。我选择做工精细,可以没有问题选择。
again works on virtual server but on iis no luck. any help would be greatly appreciated as i have looked on the web and havent found anything of use. My selects work fine and can select without a problem.
连接字符串为
<add name="db_ac_motors_testConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\db_ac_motors_test.mdf;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
插入图是从MVC局部视图一个电话,是通过ajax.beginform进行()
The insert is a call from a MVC Partial view and is done through ajax.beginform()
推荐答案
最后花几个小时寻找某种异常我保存在事件日志中的堆栈跟踪,发现后该错误
After finally spending couple hours looking for some sort of exception I saved the stack trace in an event log and found this error
System.Data.SqlClient.SqlException: Failed to update database "(database directory)" because the database is read-only.
因此,与在互联网附近垂钓它不得不做与用户的权限限制。
So with some fishing around the internet it had to do with a user permission restriction.
这里是一个链接,如果有人跑进了同样的问题。我想调试虚拟服务器上只部署读取文件夹的权限,因此不同的限制(IIS是有点挑剔,当谈到权限)。我很惊讶,正在返回也不例外......我不得不做这么多,访问堆栈跟踪,我不想甚至开始...反正链接这只是遵循的步骤,它应该指向你在正确的方向。
here is a link if anyone runs into the same problem. I guess the debugging virtual server reads folder permissions differently hence the restriction only on deployment(IIS is a little fussy when it comes to permissions). And I was surprised that no exception was being returned...I had to do so much to access the stack trace, I don't want to even begin... Anyways the link is this just follow the steps and it should point you in the right direction.
<一个href=\"http://social.msdn.microsoft.com/forums/en-US/sqldataaccess/thread/2e776fb4-6df9-4a11-96f1-948b8a2f839a/#page:2\" rel=\"nofollow\">http://social.msdn.microsoft.com/forums/en-US/sqldataaccess/thread/2e776fb4-6df9-4a11-96f1-948b8a2f839a/#page:2
这篇关于LINQ to SQL的插入不工作部署服务器(IIS)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!