1. Create 1 Azure accounts, log in and create 1 azurestorage, and the lower left manage access will see primary access key and storage account, remember their location, Wait for the configuration to be configured in Web. config.
2. Create Web.api project, upload the image code:
[HttpPost] public async task
Contains two action,postfile and Azureimageurls, which are used to receive a post-file object, which is used to get a URI from Azure back to the client.First, when uploading, you need to set this line of code:
Publicaccess = Blobcontainerpublicaccesstype.blob
If not set, the default access permission is not to directly access the BLOB picture on the client, so the picture is not displayed.
Second, this line of code needs to be set in the API when the client obtains the URI:
HttpContext.Current.Response.AddHeader ("Access-control-allow-origin", "*");
3. Web Config
<appSettings> <add key= "azureimagestorage" value= "defaultendpointsprotocol=http; Accountname=name; Accountkey=yourkey "/> </appSettings>
It is important to note that there is no space allowed in value. This link string is the standard form, and more azure link strings can be referenced by:
Https://www.connectionstrings.com/windows-azure/
4. Recommended download Cloud Berry This kind of FTP-like management tool, easy to view the uploaded pictures, if the wrong pass can be deleted:
Http://www.cloudberrylab.com
5. Client HTML implementation: