I'm getting this exception:

An invalid parameter was passed to the function

when trying to create new instance from SqlFileStream. code:

var fileStream = new SqlFileStream(strSqlPath, bytArrContext, FileAccess.Write)

I checked for all the parameters non of them are null. I've been using this same exact code for awhile with no problems, i have no idea what's happening right now.

有帮助吗?

解决方案

It is because of transaction. Please do this inside of a transaction scope.

其他提示

The current answer was not specific enough for me. The essence is that:

new SqlFileStream(dataRow["FileStreamPath"].ToString(), (byte[])dataRow["TransactionContext"], FileAccess.Read)

Should be called within the TransactionScope.

When you want to use the SqlFileStream you still have to be within the transaction. You can convert it to for example a regular MemoryStream to use it outside the transaction.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top