Windows Azure - Serve unknown (mp4) MIME types in Windows Azure IIS storage

前端 未结 4 1458
星月不相逢
星月不相逢 2020-12-08 11:21

I have a windows azure deployment (a web-role) that on request pulls in a pair of video files (mov and mp4) from azure storage into it\'s own local IIS storage, which I then

相关标签:
4条回答
  • 2020-12-08 11:35

    I used suggestion from https://social.msdn.microsoft.com/Forums/azure/en-US/79eb0c22-fe78-41d6-ac57-03055610b2a8/mp4-media-files-on-azure-website?forum=windowsazurewebsitespreview&prof=required:

    <staticContent>
      <remove fileExtension=".mp4"/>
      <mimeMap fileExtension=".mp4" mimeType="video/mp4" />
      <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="7.00:00:00" />
    </staticContent>
    
    0 讨论(0)
  • 2020-12-08 11:43

    For the answer to the specific question about playing videos in MIME Type of MP4.

    answered here

    0 讨论(0)
  • 2020-12-08 11:46

    Can you not add custom mime type in web.config? I just ran into this link:

    http://www.iis.net/ConfigReference/system.webServer/staticContent/mimeMap

    The relevant web.config xml is:

    <configuration>
       <system.webServer>
          <staticContent>
             <mimeMap fileExtension=".syx" mimeType="application/octet-stream" />
             <mimeMap fileExtension=".tab" mimeType="text/plain" />
          </staticContent>
       </system.webServer>
    </configuration>
    

    Hope this helps.

    0 讨论(0)
  • 2020-12-08 11:52

    To configure the mime type, create a new web.config file with this content in the video folder:

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
      <system.webServer>
         <staticContent>
            <mimeMap fileExtension=".mp4" mimeType="video/mp4" />
            <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="7.00:00:00" />
         </staticContent>
      </system.webServer>
    </configuration>
    

    This solution works for Azure only, the local project may no longer work. My solutions is to use "Add Config Transform" for the plublication with an empty web.config file for local project:

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
    </configuration>
    

    And when you right click on web.config, select "Add Config Transform":

    In the web.Release.config file add this into de configuration tag:

    <system.webServer xdt:Transform="Insert">
      <staticContent>
        <mimeMap fileExtension=".mp4" mimeType="video/mp4" />
        <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="7.00:00:00" />
      </staticContent>
    </system.webServer>
    
    0 讨论(0)
提交回复
热议问题