maxshuty
maxshuty

Reputation: 10662

Azure Deployment from Visual Studio not deploying a JSON file correctly?

I've deployed my website to Azure, every single thing on the website got deployed just fine except a JSON file which contains a bunch of quotes.

I'm getting a 404 not found error in the console. I've tried redeploying, and that didn't work either.

When I go to the website I just get the 404, it clearly thinks that it's adding the file.

The PublishProfile looks like this:

  <PropertyGroup>
    <WebPublishMethod>MSDeploy</WebPublishMethod>
    <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
    <LastUsedPlatform>Any CPU</LastUsedPlatform>
    <SiteUrlToLaunchAfterPublish>http://user.azurewebsites.net</SiteUrlToLaunchAfterPublish>
    <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
    <ExcludeApp_Data>False</ExcludeApp_Data>
    <MSDeployServiceURL>user.scm.azurewebsites.net:123</MSDeployServiceURL>
    <DeployIisAppPath>user</DeployIisAppPath>
    <RemoteSitePhysicalPath />
    <SkipExtraFilesOnServer>True</SkipExtraFilesOnServer>
    <MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
    <EnableMSDeployBackup>True</EnableMSDeployBackup>
    <UserName>$user</UserName>
    <_SavePWD>True</_SavePWD>
    <_DestinationType>AzureWebSite</_DestinationType>
  </PropertyGroup>

When I right click on my quotes.JSON file it has an option to Publish it. After I clicked the button to published it, it returned a response: "Your file(s) have been successfully published."

Going back to my site, it's still not there.

Interestingly enough I successfully deployed to another hosting service to test it out and everything works perfect - however, I cannot use the other service and have to stick to Azure.

Clearly something with Azure is being screwy and I'm not sure what it is.

Upvotes: 4

Views: 1398

Answers (1)

maxshuty
maxshuty

Reputation: 10662

Azure requires this in the Web.config to properly deploy a JSON file:

 <system.webServer>
     <staticContent>
      <!--For Azure Deployment-->
      <mimeMap fileExtension=".json" mimeType="application/json" />
    </staticContent>
  </system.webServer>

This will make it blow up when you run on local so make sure to only include this in the release config.

Upvotes: 12

Related Questions