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 6853819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:33:25+00:00 2026-05-27T01:33:25+00:00

I am running a .NET 4.0 web application locally using the Visual Studio Development

  • 0

I am running a .NET 4.0 web application locally using the Visual Studio Development Server (built in web server with VS2010), and for the last couple months, my StructureMap bootstrapper file has worked perfectly.

I’m using StructureMap 2.6.1

I have not changed the Bootstrapper file or the Web.config file, and suddenly, I’m getting this strange error when trying to start up my web application.

Here is the error being thrown from the website:

error

it’s a bit tough to read. It says:

Security Exception
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.
Exception Details: System.Security.SecurityException. Request Failed.

here is the code in my bootstrapper file:

public class BootStrapper
{
    public static void ConfigureStructureMap()
    {            
        ObjectFactory.Initialize(x =>
        {
            x.AddRegistry<ProductRegistry>();
        });
    }   
}

public class ProductRegistry : Registry
{
    public ProductRegistry()
    {

        For<IFirmRepository>()
            .Use<FirmRepository>().Ctor<string>("connectionString").Is(ConfigurationManager.ConnectionStrings["FeesAndFlows"].ConnectionString);

        For<ICryptographyService>()
            .Use<Rijndael>();

        For<IUserRepository>()
            .Use<UserRepository>().Ctor<string>("connectionString").Is(ConfigurationManager.ConnectionStrings["FeesAndFlows"].ConnectionString);

        For<IAuthenticationService>()
            .Use<AuthenticationService>();

        For<ILogger>()
            .Use<DatabaseLogger>();

    }
}

The error is being thrown on this line:

x.AddRegistry<ProductRegistry>();

I’ve already tried adding each of these lines to my Web.config file, one at a time, and they didn’t fix the problem:

<trust level="Full" />

and

<securityPolicy>
    <trustLevel name="Full" policyFile="internal"/>
</securityPolicy>

Does anyone have any ideas or might have heard of a problem like this? It’s pretty important, b/c without StructureMap starting up correctly, my entire application will not run.

Thanks,
Mike

UPDATE:

Ok, so it appears my problem is local. Other developers here can download the code, and runs it just fine on their local machines. Weird. They bootstrap StructurMap just fine and all instances are resolved…

Any ideas on why just my machine can’t bootstrap StructureMap when running in debug mode locally for my web project?

  • 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-05-27T01:33:26+00:00Added an answer on May 27, 2026 at 1:33 am

    Okay, so this was the problem. The StructureMap.dll was blocked by Win 7. I don’t know how is become blocked or where it became blocked, but apparently, when I downloaded the StructureMap.zip file onto my system, the .zip file was blocked, which in turn, led to all the items extracted from the .zip file being blocked as well.

    Every time I unblocked it, it went back to blocked when I tried to run the web app.

    The way I fixed it was to go back to the original .zip file, unblock it, extract it, and then replace my StruectureMap.dll reference with one that was not blocked.

    Insane.

    I don’t even know WHAT causes file to suddenly become blocked or what process in Windows 7 determines what file(s) should be blocked, but this strange operating system “feature” cost me a day’s worth of work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When running an ASP.NET web application on a local development machine, e.g. http://devmachine:1234 ,
We have a ASP.Net 2.0 web application up and running with the server in
I have an ASP.NET 2.0 web application running on a shared server of a
I have a .NET 1.1 Web Application running on a local development machine and
I have one ASP.NET web application running at the web server root which provides
I have a Web Application in Asp.Net 4 running locally on IIS 7. I
I have an ASP.Net web application running on an IIS server, and I need
I'm currently running Lucene.net in a web application and am wondering about the best
i have two .net web application and they ara running on different domain same
I have a small web application with ASP.NET AJAX running well under the Cassini

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.