Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8113965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T03:00:01+00:00 2026-06-06T03:00:01+00:00

I’m developing an MVC 3 application with a plugin functionality. The plugins are C#

  • 0

I’m developing an MVC 3 application with a “plugin” functionality. The
plugins are C# dll’s with all required resources (css, images and scripts) embedded.

I’ve used the “MvcRazorClassGenerator” Visual Studio extension to create precompiled views.

I retrieve the embedded resource using the following code:

public FileStreamResult EmbeddedResource(string pluginName, string resourceName)
{
  Assembly assembly = PluginCache.GetAssembly(pluginName);

  if (assembly != null)
  {
    string tempResourceName =
      assembly.GetManifestResourceNames()
              .ToList().FirstOrDefault(f => f.EndsWith(resourceName));

    return new FileStreamResult(
                  assembly.GetManifestResourceStream(tempResourceName), 
                  GetMIMEType(tempResourceName));
  }  

  return null;
}

In the views I have following code to access resources:

@Url.Content("/Common/EmbeddedResource/PluginName/[AssemblyNamespace].Content.Images.blank.gif")

All is working fine while I am in the development environment, all resources are loaded and displayed correctly, but when deploying, the nightmare is started.

IIS 7.5 keeps searching for a static file called “/Common/EmbeddedResource/PluginName/[AssemblyNamespace].Content.Images.blank.gif” and not the embedded file, giving me the 404 error for all embedded resources.

I’ve tried installing a hot fix mentioned by a question on this site and changing config files but the resources are not loaded.

I’m trying to deploy to Windows 2008 Server R2 SP1 64bit.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T03:00:04+00:00Added an answer on June 6, 2026 at 3:00 am

    The problem may be the use of

    Url.Content("/Common/EmbeddedResource/PluginName/[AssemblyNamespace].Content.Images.blank.gif")
    

    I have the same set up but since the content is served from an action I use

    @Url.Action("EmbeddedResource", "EmbeddedResources", new { pluginName = "PluginName", resourceName = "MyProject.Scripts.MyScript.js" })
    

    I then set up a route

    routes.MapRoute(
        "EmbeddedResources",
        "EmbeddedResources/{pluginName}/{resourceName}",
        new { controller = "EmbeddedResources", action = "EmbeddedResource", pluginName = "DefaultPluginName", resourceName = UrlParameter.Optional });
    

    Which results in script references like so

    <script type='text/javascript' src='/EmbeddedResources/PluginName/MyProject.Scripts.MyScript.js'></script>
    

    If you are taking this approach, you may also want to minify the embedded files (for release builds). You can do this using the MSBuild task as detailed on this blog post.

     <Import Project="$(MSBuildExtensionsPath)\Microsoft\MicrosoftAjax\ajaxmin.tasks" />
      <PropertyGroup>
        <ResGenDependsOn>
          MinifyJavaScript;
          $(ResGenDependsOn)
        </ResGenDependsOn>
      </PropertyGroup>
      <PropertyGroup>
        <PostBuildEvent>
        </PostBuildEvent>
      </PropertyGroup>
      <Target Name="MinifyJavaScript" Condition=" '$(ConfigurationName)'=='Release' ">
        <Copy SourceFiles="@(EmbeddedResource)" DestinationFolder="$(IntermediateOutputPath)" Condition="'%(Extension)'=='.js'">
          <Output TaskParameter="DestinationFiles" ItemName="EmbeddedJavaScriptResource" />
        </Copy>
        <AjaxMin JSSourceFiles="@(EmbeddedJavaScriptResource)" JsSourceExtensionPattern="\.js$" JsTargetExtension=".js" CssSourceFiles="@(CSS)" CssSourceExtensionPattern="\.css$" CssTargetExtension=".css" JSLocalRenaming="CrunchAll" />
        <ItemGroup>
          <EmbeddedResource Remove="@(EmbeddedResource)" Condition="'%(Extension)'=='.js'" />
          <EmbeddedResource Include="@(EmbeddedJavaScriptResource)" />
          <FileWrites Include="@(EmbeddedJavaScriptResource)" />
        </ItemGroup>
      </Target>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
I have an MVC Razor view @{ ViewBag.Title = Index; var c = (char)146;
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.