Table of Contents

Troubleshooting

Errors that come from using Resourcefull's API. For problems in the database itself, such as a full transaction log, running out of connections or timeouts, see Running SQL Server.

InvalidOperationException: No provider configured.

AddResourcefull needs exactly one provider: call UseSqlServer, UseInMemory or UseProvider inside it. Calling two throws Provider has already been configured.

ResourceConflictException on upload

The name already exists and the upload is create-only, which is the default 4.0. Set Mode = ResourceWriteMode.Replace to replace the resource, and turn on versioning to keep the version it replaces too. (In 3.1, an upload is create-only when versioning is off and Overwrite isn't set, or when CreateOnly is set.)

ResourceContainerNotFoundException on upload

The container doesn't exist. GetContainerClient doesn't create or check it; use CreateContainerIfNotExistsAsync once, for example at startup or before the first upload.

ResourceContentLengthMismatchException

The upload declared a Headers.ContentLength that differs from the bytes its stream supplied, and nothing was stored. Usually the stream wasn't at the start (rewind it with stream.Position = 0), or a request body was cut short.

An upload stored zero bytes

Uploads read from the stream's current position. A MemoryStream you've just written is positioned at its end, so rewind it first. Otherwise the upload stores an empty version, which with Replace replaces the existing content.

ArgumentException for a name that looks fine

Names can't start or end with whitespace, and are limited to 128 characters for a container and 256 for a resource. A name read from a file or a form often carries a trailing newline or space. See Names.

A resource "disappeared" after upgrading

Names are case-sensitive since 3.0. Look it up in the case it was stored in; ListResourcesAsync lists the stored names.

InvalidOperationException: "…its content can't be read again to retry"

Before 4.0, a transient SQL Server failure interrupted an upload whose stream can't seek, such as an HTTP request body, so it couldn't be retried. Nothing was stored; upload again. From 4.0 4.0, such an upload sends the batch that failed again and carries on, so this doesn't happen.

IOException while reading a download

With SQL Server, the version was deleted while it was being read, so its content ended early. Read the current version again.

Scripts fail with QUOTED_IDENTIFIER errors, or carry on after an error

Run them with sqlcmd -b -I: -I turns on QUOTED_IDENTIFIER, which the filtered indexes need, and -b stops at the first error. In SSMS, use SQLCMD mode with :on error exit at the top.