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

  • Home
  • SEARCH
  • 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 4548496
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T16:13:43+00:00 2026-05-21T16:13:43+00:00

Hey all, I am running class on our IIS 7 server with all the

  • 0

Hey all, I am running class on our IIS 7 server with all the Sharepoint yimmer yammer installed. I have webservice that I created using the walkthrough on the MSDN site.

I found that I needed to use the ElevatedPrivilleges call in order to get my LINQ classes to work.

Once I did that, it seems to cause my NLog based logger to NOT be able to find the web.nlog file that I put in the same directory as the web.config file as the NLog documenation said to.

Any log statements outside the the delegate here work just fine, anything inside never comes out in the log file.

What gives, what’s really happening in that delegate?

using System;
using System.Web.Services;
using Notification.DAL;
using SharePointConnector;
using NLog;
using Microsoft.SharePoint;

namespace NotificationReceiverService
{

    [WebService(Namespace = "http://midwestiso.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]

    public class Service : System.Web.Services.WebService
    {
        private static Logger logger = LogManager.GetCurrentClassLogger();
        private static readonly String MACHINE_NAME = Environment.MachineName.ToUpper();

        public Service()
        {
            //Uncomment the following line if using designed components 
            //InitializeComponent(); 
        }

        [WebMethod]
        public string HelloWorld()
        {
            return "Hello World, You've contacted the Notifications Receiver Service. " +
                "Please refer to the WSDL for the other available methods";
        }

        [WebMethod]
        public string EchoMessage(string MESSAGE_TEMPLATE_NAME, string MESSAGE_SUBJECT, string MESSAGE_TEXT_SUMMARY,
                                    string MESSAGE_TEXT_DETAIL, string MESSAGE_TEXT_CON_OPS)
        {
            return String.Format("You called EchoMessage and told me {0}, {1}, {2}, {3}, {4}",
                MESSAGE_TEMPLATE_NAME, MESSAGE_SUBJECT, MESSAGE_TEXT_SUMMARY, MESSAGE_TEXT_DETAIL, MESSAGE_TEXT_CON_OPS);
        }

        [WebMethod]
        public string SendMessage(string MESSAGE_TEMPLATE_NAME, string MESSAGE_SUBJECT, string MESSAGE_TEXT_SUMMARY,
                                    string MESSAGE_TEXT_DETAIL, string MESSAGE_TEXT_CON_OPS)
        {
            logger.Info("------" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Name + " starting on " + MACHINE_NAME + "------");
            try
            {
                //SPSecurity.RunWithElevatedPrivileges(delegate
              //  {
                    int? newNotificationId = 0;
                    using (var db = new MISO_IR_IntegrationDataContext())
                    {
                        logger.Error("Message Received is: {0} - {1} - {2} - {3} - {4} - {5}",
                        DateTime.UtcNow.AddHours(-5), MESSAGE_TEMPLATE_NAME.Trim(),
                            MESSAGE_SUBJECT.Trim(), MESSAGE_TEXT_SUMMARY.Trim(),
                            MESSAGE_TEXT_DETAIL.Trim(), MESSAGE_TEXT_CON_OPS.Trim());

                        int dbProcReturnCode = db.InsertReceivedNotification(DateTime.UtcNow.AddHours(-5),
                            MESSAGE_TEMPLATE_NAME.Trim(), MESSAGE_SUBJECT.Trim(), MESSAGE_TEXT_SUMMARY.Trim(),
                            MESSAGE_TEXT_DETAIL.Trim(), MESSAGE_TEXT_CON_OPS.Trim(), ref newNotificationId);

                        if (dbProcReturnCode == 0)
                        {
                            logger.Info("Notification saved to DB with ID: {0}", newNotificationId);
                            logger.Debug("Getting read to call CreatePublishingPagefromNotification");
                         //   PagePublisher.CreatePublishingPagefromNotification((int)newNotificationId);
                            logger.Debug("Complete calling CreatePublishingPagefromNotification without exception");
                        }
                        else
                        {
                            throw new Exception("Unable to find mapping for this MESSAGE_TEMPLATE, saved the message to the notification table with ERRORNOMAPPING code, aborting further processing");
                        }
                    }
              //  });
            }
            catch (Exception ex)
            {
                logger.ErrorException(ex.Message, ex);
                return "ERRORPOOP";
            }
            finally
            {
                logger.Info("------" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Name + " COMPLETED ------");
            }
            return "OK";
        }
    }
}
  • 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-21T16:13:44+00:00Added an answer on May 21, 2026 at 4:13 pm

    That elevated priveleges delegate runs the code inside it as the web application account (i.e. the code no longer impersonates the user running the code).

    Find out what account the web application is running under and then figure out why the logging messages change with the user.

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

Sidebar

Related Questions

Hey everyone, running into a bit of an issue, I have created all my
Hey all. I have a server written in java using the ServerSocket and Socket
Hey all. I have written a program that sequentially scans certain parts of a
Hey all, I have a form that I type a message in, then I
Hey all, I have something of an interesting requirement for my project. I need
Hey all - I have an app where I'm authenticating the user. They pass
Hey all. I've got a new app up and running on a new ubuntu
Hey all. Im trying to sort out how to get MATLAB running as best
hey guys, we have a loop that: 1.Loops over several thousand xml files. Altogether
Hey all- I have looked this up on here and Google but none of

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.