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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:02:31+00:00 2026-05-14T00:02:31+00:00

I have a SharePoint DLL that does some licensing things and as part of

  • 0

I have a SharePoint DLL that does some licensing things and as part of the code it uses an external C++ DLL to get the serial number of the hardisk.

When I run this application on Windows Server 2003 it works fine, but on Windows Server 2008 the whole site (loaded on load) crashes and resets continually. This is not Windows Server 2008 R2 and is the same in 64 or 32 bits.

If I put a Debugger.Break before the DLL execution then I see the code get to the point of the break and then never come back into the DLL again. I do get some debug assertion warnings from within the function, again only in Windows Server 2008, but I’m not sure this is related.

I created a console application that runs the C# DLL, which in turn loads the C++ DLL, and this works perfectly on Windows Server 2008 (although it does show the assertion errors, but I have suppressed these now).
The assertion errors are not in my code but within ICtypes.c, and not something I can debug.

If I put a breakpoint in the DLL it is never hit and the compiler says:

"step in: Stepping over non user code"

If I try to debug into the DLL using Visual Studio.

I have tried wrapping the code used to call the DLL in:

SPSecurity.RunWithElevatedPrivileges(delegate()

But this also does not help.

I have the source code for this DLL so that is not a problem.

If I delete the DLL from the directory I get an error about a missing DLL. If I replace it, back to no error or warning just a complete failure.

If I replace this code with a hardcoded string the whole application works fine.

Any advice would be much appreciated, I can’t understand why it works as a console application, yet not when run by SharePoint. This is with the same user account, on the same machine…

This is the code used to call the DLL:

 [DllImport("idDll.dll", EntryPoint = "GetMachineId", SetLastError = true)]
    extern static string GetComponentId([MarshalAs(UnmanagedType.LPStr)]String s);

    public static string GetComponentId()
    {
        Debugger.Break();
        if (_machine == string.Empty)
        {
            string temp = "";
            id= ComponentId.GetComponentId(temp);
        }
        return id;
    }
  • 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-14T00:02:32+00:00Added an answer on May 14, 2026 at 12:02 am

    This could be security related:
    An important point is that it works in a console app.

    In a console app RunWithElevatedPrivileges has no effect since it emulates the app pool user for your worker process, a user that should have no special rights on the box itself.

    In contrast a console app runs in context of the logged in user.

    Try emulating a user with rights like when you run the console application specified here (with Undo() inside try/finally mind you!). When obtaining the token you can create an SPUserToken and establish site context using the SPSite constructor that takes a GUID and a SPUserToken

    Theres several examples out there documenting this approach, here for example.

    EDIT: oh and the reason it worked on 2003 could be that your app pool account had way too many rights 😉

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

Sidebar

Related Questions

We have a SharePoint solution that uses a standard task list. We would like
I have a need to reference two different versions of the Sharepoint API dll.
We have a SharePoint Team Site (WSS 3.0 not MOSS), that includes Tasks list
i have a Sharepoint feature that essentially extends Lists with a new feature, using
I have a SharePoint WebPart project in visual studio. As part of the project
I have a MOSS 2007 Webpart that displays data obtained from an external webservice
To investigate a problem that we have with SharePoint 2007, I wrote a small
I have a web part that I have been deploying to Server A. I
I have SharePoint with the local intranet link as http://shserver/Sites/LAPP/HR/LA . I want to
We have a SharePoint list setup with history enabled so the Comments field keeps

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.