Skip to content Skip to sidebar Skip to footer

Linq To Sql Insert Not Working On Deployed Server(iis)

title speaks for itself, db.ExecuteCommand('INSERT INTO tCSVFile(fileName, fileContent, mimetype, timeCreated) VALUES({0}, {1}, {2}, {3})', filename, EncodeTo64(CreateCSVFile(heade

Solution 1:

Are you certain the database is attaching correctly. Many ISPs have it set up so you cannot attach a database using the connection string methdology you have employed. That is the first place you should look. I would think you would get an error, but it might be swallowed up somewhere in the stack.

If you need to move SQL to a SQL instance (not SQL Express necessarily) rather than attach, this might help: http://gregorybeamer.spaces.live.com/blog/cns!B036196EAF9B34A8!630.entry?sa=214268831

Solution 2:

What does the function/method CreateCSVFile() do? If it writes files to the filesystem then it looks like you have a permissions problem. i.e. The anonymous user for the site may not have write permissions.

Just a thought.

Kev

Solution 3:

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.

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.

http://social.msdn.microsoft.com/forums/en-US/sqldataaccess/thread/2e776fb4-6df9-4a11-96f1-948b8a2f839a/#page:2

Post a Comment for "Linq To Sql Insert Not Working On Deployed Server(iis)"