Well, even though the referenced System.Net.Http.Formatting.dll in both projects was version 4.0.0.0, when I browsed to the definition of the ReadAsMultiPartAsync method in my project the correct method didn't show up in the metadata. So I removed my reference to the dll in my project, and then added the dll from the sample project's bin, and that solved the problem. Seems really stupid, and I worry that it could break again, but that's the best solution that I have.
ReadAsMultipartAsync<T> won't take a Type argument
-
13-12-2021 - |
Question
I downloaded a sample project for saving images to Azure Blob Storage via a Web Api service here: http://blogs.msdn.com/b/yaohuang1/archive/2012/07/02/asp-net-web-api-and-azure-blob-storage.aspx.
However, I cannot get this one line in the controller to work:
Request.Content.ReadAsMultipartAsync<AzureBlobStorageMultipartProvider>(multipartStreamProvider)
The error is
The non-generic method 'System.Net.Http.HttpContentMultipartExtensions.ReadAsMultipartAsync(System.Net.Http.HttpContent, System.Net.Http.IMultipartStreamProvider, int)' cannot be used with type arguments
I have tried to compare my project to the sample project, to no avail - the references are the same, the AzureBlobStorageMultipartProvider class hasn't changed in my project ... I can't figure out what the difference is. ReadAsMultiPartAsync is an extension method, but I obviously have those extensions in scope (they're referenced in the error message). Can anyone help?
Solution