4

I deployed my MVC-3 project on the windowsAzure cloud service. Then when i opened it through

staging url. The images are not showns in my application. My image src is a relative address which is :

<img src="/images/1.jpg" alt="Lion" /> 

I am using jquery-UI as well but it plugins like ( button ) are also not working. I used cycle plugin, pagination plugin these are aslo not working. Whats the problem ?

2
  • This question is not Azure Specific. It is general web deployment. Beside the action you need to take mentioned by Jim Tollan, you also need to include all your images and other content in the project and mark them as "Content". Otherwise these will not be deployed to whatever hosting you are doploying.
    – astaykov
    Jul 26, 2012 at 10:16
  • ok, but in my project layout.cshtml i used <link href="@Url.Content("~/Content/jquery-ui-1.8.18.custom.css")" rel="stylesheet" type="text/css" /> for jquery-ui, here i used Url helper but than also it is not applying button plugin on the buttons of my project. why?
    – King Kong
    Jul 26, 2012 at 10:22

4 Answers 4

3

altho your path 'appears' relative, you'll need to use the Url helper to navigate the folder structure correctly. Try using the below instead:

<img src='@Url.Content("~/images/1.jpg")' alt="Lion" /> 

All remote hosting is fickle and Azure is certainly no exception. This issue always catches me out if I omit the @Url.Content() helper. I'm certain this will work.

1
  • king-kong - those jquery images will be relative to the css file and folder and thus WILL be an absolute relative path along the lines of images/myimage.jpg. the difference with mvc views is that they are called by a controller that has a route which can vary wildly from the folder structure, hence the use of the Url helper
    – jim tollan
    Jul 26, 2012 at 10:17
2

The problem probably is because your image is not imported in the MVC project. When you deploy a Cloud Service, only the resources that are in the project are deployed. Resources that are just in your file system are not.

1

I had this same issue and did the following:

  1. my Images folder was outside the \Content directory, therefore, I created a directory inside this directory, so now I had \Content\images
  2. I now moved my images to this new directory
  3. Did a right-click on the images folder name in the Solution Explorer and clicked on option "Include in Project", I also did a right-click on the images itself and chose same option
  4. Published and Voila it worked!
0

I had the same issue. I remote desktop to my server in Azure, opened IIS, went to the folder where I have the images and tried to Browse it, I got an Internal Server Error telling me "The requested page cannot be accessed because the related configuration data for the page is invalid". The issue was with this staticContent definition:

<mimeMap fileExtension=".mp4" mimeType="video/mp4"/>

So I opened the web.config, searched for "mp4" and removed the section where I was defining that mimeMap.

After that I could browse the image and when I refreshed my page in my local machine all images showed up.

I then deleted that mimeMap definition from my Web.Release.config file. I had created it because previously I had published this project as a WebSite in azure and I couldn't deliver mp4 videos using the tag, but that seems not to be necessary when using a Cloud Service.

Hope this helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.