Microsoft Office SharePoint Server 2007 SQL user account failure audits in the Application log

If you’re like me, you cant stand any repetitive errors in your event log.

The other day I was reviewing the application log on my MOSS 2007 server and found the following events:

 

image

Great…Like clockwork, every minute, another error.  This is a screen shot of my Application Log, shouldn’t this nonsense be in the Security Log?!?….

Well, before i start to panic, I look at my change com and see that a couple days ago some work was done on the Shared Service Provider (SSP).  You know, that suite of services that handles all the cool stuff in MOSS.

  • Profiles and Audiences
  • My Sites
  • Search
  • All of Excel Services
  • All of the BDC (Business Data Catalog)

The interesting thing…All of those “cool” services were just fine.

So, I do some exploring, specifically inside SQL management Studio

(Considering that’s the source of the problem, not to mention Global Warming, Locust outbreak in Canton Illinois, etc).

image

image

What’s this?  Under My SQL Jobs, there is a list of 4 DB_Job_DeleteExpiredSessions (of which, none are actually my current SSP)

NewSSP

HMMM>>>>So, I right click and disable all of them…

After a couple hours I come back and no new logs.  COOL! 

to finish, I delete the previous jobs and clear my event logs:

clearevent

Considering myself lucky, I decided to reverse engineer a “Google” fix.  Of course, I found the answer on Eventid.net, specifically this entry:

http://eventid.net/display.asp?eventid=18456&eventno=8175&source=MSSQLSERVER&phase=1

Mark Kelsay
In my case, this SQL server was hosting several MOSS 2007 databases. I found that the SQL agent was trying to login to a database that did not exist. MOSS uses SQL Server Jobs to delete expired sessions on a set schedule, every minute, to free up resources that are not being used. You will need to go into SQL Server management studio and disable the job called SharedServices_DB_job_deleteExpiredSessions. Once this is done you should no longer see those error messages in the event log. If you disable the right job, and the error message no longer appears, you can then delete the job. Always disable first. You do not want to delete until you are sure you got the right job.

Maybe you will find it useful,

Until then,

JP

Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Twitter

Filed under: Miscellaneous | Posted on May 24th, 2010 by JohnP | No Comments »

Enterprise Library Logger.Write Not Working?

Using Logging Application Block provided by Enterprise Library is a common way of logging exceptions in .NET applications.  It’s easy to setup and to use.  One problem I had a while ago was that it worked while on my development PC, but stopped working once it’s deployed.

What I was doing was to use it to write event entries in windows event log as part of the exception handling in an ASP.NET web application.  Nothing fancy.  It worked fine on my PC, but it didn’t write anything to the event log when Logger.Write is executed. No exception was thrown from that line of code either.  The program just went through as if that line of code was skipped.

It turned out to be a permission issue. When I debug the application in Visual Studio, it was running under my windows account credential which had permission to create Event Source in the system.  However, when the application was deployed to the server, it was running under the default account which was “NT Authority\Network Service” in my case.  By default, that account doesn’t have permission to create new Event Source in the system.  It does have permission to write event entries though.  So, when Logger.Write was executed, it couldn’t proceed because the Event Source wasn’t there, and the program didn’t have permission to create one.  Actually, it makes sense to not throw any exception on this line, because people like me usually use this to log exceptions, and if the logging process itself throws exceptions, there is probably nowhere else we can handle and/or log them.

Now, how this can be resolve?  The solution is quite simple.  As long as the Event Source is created ahead of time, it will be no problem.  What I did was to create required Event Source(s) on server through CMD.exe.  Here is a sample command:

eventcreate /ID 1 /L Application /T information /SO "My Event Source" /D "My Event Source is created."

This command will create an event entry in the Application log.  If the Event Source doesn’t exist, it will be created during the process.  This is only required when the application is deployed to the server first time.  So, I usually do it manually on server.  However, if that’s not the case, you can build it into the installation package, and when the application is installed, the Event Source is created as well.  Of course, you can use .NET to create Event Source in your installer too.

Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Twitter

Filed under: Application Development, Microsoft | Posted on May 17th, 2010 by Geer | No Comments »

Shared Services Provider stuck at (Unprovisioning)

I ran into this the other day. 

Backstory:

I attempted to delete the Shared Services Provider (SSP)

Technorati Tags: , but after letting it run for several hours, it never moved passed the “Unprovisioning” state on the Central Administration Website.

image

No Problem!

STSadm to to rescue…again:

when this happens, you have no choice but to get out the command line toolbox and force the Shared Services Provider to be removed.

the following command to do that is:

stsadm –o deletessp –title <SSP name> –force.

let it chew a little while, then reload the Central Admin page and the SSP should be gone.

Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Twitter

Filed under: Miscellaneous | Posted on May 14th, 2010 by JohnP | No Comments »

Snippet

A neat new tool in Windows 7 is the “Snipping tool”.

It can be found in “All Programs” >”Accessories” > Snipping tool

image

Drag it to your “Quick Launch” bar and have fun!

Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Twitter

Filed under: Miscellaneous | Posted on May 13th, 2010 by JohnP | No Comments »

Exception Handling in ASP.NET Web Application

In web application development, we should always think about returning some kind of message to users when an exception is raised in the program.  Sometimes, it can be very specific, while in other cases it can be generic.  A common thought is to capture and possibly handle exceptions where they are raised, re-throw exceptions or raise custom exceptions as needed so they can propagate up to higher level tiers in the application, handle/log exceptions at a central place in the highest tier of the application, and finally display an error message to the end-users or redirect them to a customized error page.

This pattern works, but sometimes it is tricky to generate a meaningful message.  The problem is that the exception can be thrown anywhere in your application, and the exception message may not always be appropriate or meaningful to end-users.  If you blindly display all exception messages you finally get, users may see something like “Object reference not set to an instance of an object” which doesn’t mean much to them.  So, in the final step of exception handling (where the program displays error messages or redirect users to an error page), you will see all kinds of exceptions which include .NET originated exceptions, exceptions raised by the program on purpose, and custom exceptions.  Some of them are appropriate to show to users, while others aren’t.  So, the question is how you can distinguish among them.

A lot of people suggest that if the original .NET exception message isn’t meaningful to users, and you can’t provide more specific message either, then a generic message such as “An error has occurred…  Please contact the technical support team for help” can be used.  I agree too.  You may do this where you know an exception can be thrown, and re-throw the exception with customized message (whether specific or generic) and with the original exception embedded as the inner exception of the new exception.  However, you don’t want to just put try/catch blocks in every piece of your code, and catch and re-throw every exception the program may possibly encounter.  It’s labor intensive and inefficient.  Also, there will always be something you can’t think of or look over, so there are still chances you can get unexpected exceptions in the end.

So, my solution is to let the program only catch and re-throw .NET originated exceptions when they are predictable and additional meaningful information can be provided, and let all other exceptions bubble up to the top tier.  Then in the final step of exception handling, identify the exceptions that are re-thrown, and retrieve the error message directly from these exceptions; use a generic error message for all other exceptions.  The question is how to identify these exceptions that are re-thrown.  For this purpose, I usually create a custom exception class which is inherited from System.Exception.  Use this class whenever I need to throw new exceptions or re-throw .NET originated exceptions.  So, in the final step, I check the type of the exception, and decide whether to use it as the error message or use a generic one instead.

Here is the custom exception class:

  1. public class ExceptionBase : Exception
  2. {
  3. public ExceptionBase(string msg, Exception innerEx)
  4. : base(msg, innerEx)
  5. {
  6. }
  7. public ExceptionBase(string msg)
  8. : base(msg)
  9. {
  10. }
  11. }

The ExceptionBase class has two constructors which give you the options to create an instance of exception with customized error message and with/without inner exception.

Here is how to use it in code:

  1. throw new ExceptionBase(“Error has occurred in accessing database.”);

Or

  1. try
  2. {
  3. // Data access operations
  4. }
  5. catch (Exception ex)
  6. {
  7. throw new ExceptionBase(“Error has occurred in accessing database.”, ex);
  8. }

The central location I handle all exceptions is in global.asax, and here is what it looks like:

  1. protected void Application_Error(object sender, EventArgs e)
  2. {
  3. Exception ex = Server.GetLastError();
  4. string msg = “Unexpected error has occurred.”;
  5. if (ex != null)
  6. {
  7. LoggingUtility.LogException(ex);
  8. // Remove the HttpUnhandledException wrapper if there is one
  9. if (ex.GetType() == typeof(HttpUnhandledException) && ex.InnerException != null)
  10. {
  11. ex = ex.InnerException;
  12. }
  13. // If this is a custom exception, change the message.
  14. if (ex is ExceptionBase)
  15. msg = ex.Message;
  16. Server.ClearError();
  17. }
  18. // Try to redirect user.
  19. Response.Redirect(string.Format(“~/Error.htm?aspxerrorpath={0}&error={1}”, HttpUtility.UrlEncodeUnicode(Request.Url.PathAndQuery), msg), true);
  20. }

One note for this is that ASP.NET may put a wrapper exception (HttpUnhandledException) around the original exception.  In the code above, it is simply removed because it doesn’t contain any useful information.

You can also create more custom exception classes based on the ExceptionBase class to improve consistency in your application, and the code above will still work.  One example is:

  1. public class BadUrlException : ExceptionBase
  2. {
  3. public BadUrlException(Exception innerEx)
  4. : base(“Bad URL has been detected. Request could not be processed.”, innerEx)
  5. {
  6. }
  7. }

This way the error messages for one type of exception are consistent across the application.

Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Twitter

Filed under: Application Development, Microsoft | Posted on April 22nd, 2010 by Geer | No Comments »

How to Use Microsoft Device Emulator in VS2008

Microsoft Device Emulator is a great tool for testing your mobile web applications without utilizing any real mobile device.  Because it can use the same network that your computer is on, you can use it to test your mobile web applications hosted on development computers or test servers before the applications are published to the internet.  It is part of the Visual Studio 2008, so you can set it up with very minimal work, if you already have VS2008 installed.  It can also be installed separately.  In the rest of this post, I will demonstrate how to set it up, to use your local network and access your mobile web applications.

Here are a few things you will need to have on your computer to continue.

  1. Windows Virtual PC 2007.  This is required, if you would like to connect the Device Emulator to your local network.  The software can be downloaded from Microsoft website.
  2. Microsoft Visual Studio 2008.
  3. Microsoft Device Emulator (which comes with VS2008).

With all the above requirements available on your computer, you can follow the steps below to configure your Device Emulator.

  1. Start VS 2008 IDE.
  2. On the menu, go to Tools >> Device Emulator Manager
    Start Device Emulator Manager

    Start Device Emulator Manager

  3. Right-click on a device you would like to use, and choose Connect option.

    Connect to A Mobile Device

    Connect to A Mobile Device

  4. After the device is connected, right-click on the connected device again, and choose Cradle.

    Cradle the Connected Device

    Cradle the Connected Device

  5. Go to the device window.  On the menu, choose File >> Configure

    Configure Device

    Configure Device

  6. Go to the Network tab, and select the options as shown in the screen shot below.  And then click OK to close the window.

    Choose Network Card

    Choose Network Card

  7. In the device window, on the menu, choose File >> Reset >> Soft.  And wait until the device is restarted.
  8. Now you need to configure the internet connection in the mobile device.  (The process could be different depending on what device you have picked.)  Normally, you would find the Settings option in the main menu, and then go to the Connections section to choose/define an internet connection.  Here below I use the device I chose as an example.
  9. Choose Settings >> Connections >> Advanced >> Select Networks, and then choose My ISP for both Internet and Private Network connections.

    Choose Settings

    Choose Settings

    Choose Connections

    Choose Connections

    Choose Advanced Settings

    Choose Advanced Settings

    Choose My ISP

    Choose My ISP

  10. After confirming all these changes, you can now visit your mobile web application or internet using this Device Emulator.  Task accomplished!

    Your Mobile Website

    Your Mobile Website

Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Twitter

Filed under: Application Development, Microsoft | Posted on March 31st, 2010 by Geer | No Comments »

Setting Siebel EIM Process Batch Number in Command Line

My customer’s current process of importing data into Siebel database is to use Siebel EIM interface.  The data which needs to be imported will be formatted and inserted into EIM tables (or the staging tables), and then an EIM process will be ticked off in the command line to import the data into Siebel base tables.  The command is fairly simple, and should be similar to the following:

[Path to The Siebel Application Bin folder]\srvrmgr.exe /g [Siebel Application Server Name] /e [Target Siebel Environment] /s [Siebel Application Server Name] /u [User Name] /p [User Password]


run task for component EIM with config=”[Config File].ifb”,Process=”[Process Name]“

The first command starts the srvrmgr program, and the second one ticks off the EIM process.  The configuration file ([config File].ifb) specifies all the parameters needed by the EIM interface in order to complete the process.  One of the important parameters we need to set in the .ifb file is the BATCH, which is the identifier for the group of data being handled during the current process.  Normally, we set it to a fixed number or a range of numbers (for example, 500-600).  So, when the EIM process runs, only the data with a batch number equal to the BATCH or falling in the range specified in the .ifb file will be processed.  If in the EIM tables there are some records which are not ready to be processed at this moment, they can be skipped by identifying themselves with a different batch number.  This is helpful when you are managing multiple data importing tasks which share the same set of EIM tables, and run at different time.

However, we soon realized that it would be getting harder and harder to manage these .ifb files and to make sure these EIM processes don’t interfere with each other.  For example, one of our custom applications needs to import data into Siebel using EIM interface upon users’ requests.  The data importing process is exactly the same for all these requests, except for the data needed to be imported.  Multiple users need to be allowed to submit their requests at the same time, and their requests should be handled separately.  If we were going to do it in the old fashion, we would need to have a .ifb file for each of their requests, and use different batch numbers in these .ifb files.  It is not realistic, or it is something we want to do either.

The solution is actually very simple.  We took the BATCH setting out of the .ifb file, and instead we set it in the command line.  This was not documented in the Siebel EIM Admin Guide, but after our testing it was proved to be a working solution.  The command will look like the following now:

[Siebel Application Bin folder]\srvrmgr.exe /g [Siebel Application Server Name] /e [Target Siebel Environment] /s [Siebel Application Server Name] /u [User Name] /p [User Password]


run task for component EIM with config=”[Config File].ifb”,Process=”[Process Name]“,BATCH=[Batch Number]

This way the application can choose a BATCH number unique to the user’s request, construct the command, and then execute it to tick off the EIM process, and all these requests can share the same .ifb file.

To manage the batch numbers among different applications, we reserved a range of batch numbers for each application.  For example, from 500 to 549 will be used only by application A, and from 550 to 599 will be used only by application B.  Within each application, a batch number is assigned to each request based on the request identifier and the range of batch numbers reserved for the application.  In our case, the request ID is an auto-incrementing integer, and the equation for calculating the batch number is:

[Batch Number] = [Request ID] % [Total Number of Allocated Batch Numbers] + [The Lowest Batch Number]
(Where % stands for the modulus operator)

For example, if the allocated batch numbers are from 500 to 549, and the current request ID is 1034, the batch number for this request will then be:

534 = 1034 % (549 – 500 + 1) + 500

This way the adjacent requests would have different batch numbers, and the batch numbers are used in a cycle.  In our case, we will never have more than 50 users submitting their requests at the same time, but if this was for a larger user base, we could allocated a bigger range of batch numbers.

So, we finally were able to manage all users’ requests using limited batch numbers and a single .ifb file without the requests being interfered by each other.  Task accomplished!

Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Twitter

Filed under: Application Development, Miscellaneous | Posted on March 25th, 2010 by Geer | No Comments »

Developing with Windows Mobile 7

Microsoft recently announced the general availability of developer tools for their Windows mobile platform. This article is a brief introduction to the platform and what the next generation of mobile development for Microsoft looks like.

After you’ve downloaded the developer tools installer, you will go through a download process…


WinMo Dev Tools Setup

After downloading the remaining components, you will install all component resources.


WinMo Dev Tools Install

Once the developer tools have been installed, you can startup Visual Studio 2010 Express for Windows Phone which is the IDE used for the mobile development.


Visual Studio 2010 Express Splash

We will use the Silverlight for Windows Phone – Windows Phone Application project template and add some custom XAML and image resource to the base project.


WinMo Project Creation

In this simple application we’ve titled Mobile Portal just going to add some textblocks, buttons, and use a standard Silverlight grid layout. We first modify MainPage.xaml to create our custom view for the mobile application. Here is a view of our coding changes.


WinMo MainPage XAML

Next, we go to our Solution Explorer add our image resource using the context menu on the project and selecting Add -> Existing Item.


Solution Explorer - Add Resources

Finally, we add our custom styles to App.xaml. After building the solution and running the emulator, we see the following results.


WinMo Pearl Technology - Issue Tracker

If we rotate the device orientation, we can see how the view shifts to fit the space available.


WinMo Pearl Technology - Issue Tracker - Horizontal

We are glad to see that Microsoft is embracing the WPF and Silverlight-based development engine for the mobile platform. This decision allows developers and designers skilled in XAML to leverage their existing knowledge and prowess to create useful mobile applications for both business and pleasure. The small footprint of Silverlight makes it ideal for usage with embedded or mobile systems with limited power and memory.

You can download our complete solution here.

Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Twitter

Filed under: Application Development, Microsoft | Posted on March 24th, 2010 by AaronH | No Comments »

Green IT

Applying sound environmental practices to your technology just makes sense for business. Green technologies not only help the environment, but also save money and improve business operations.

Recycle – Computers, monitors, and other electronics contain toxic materials that can harm the environment and create an estimated 70% of the toxins found in US landfills. There are recycling programs and companies who can take your obsolete equipment off your hands and dispose of it correctly.

Reuse – Gently used PCs and other equipment can be donated to a nonprofit organization—some tax incentives are offered for this. Be sure that any machines you donate are wiped clean of any potentially sensitive data and that the charity or school you choose has the resources to handle this type of donation.

Reduce – Learn to identify the worst e-waste offenders and make the most of your resources. Reduce cost and resource usage by implementing green solutions throughout your business.

A very helpful article on reducing e-waste and utilizing more “Green IT” in your company’s business operations, “5 Steps to Green IT,” can be found at http://www.eweek.com/c/a/IT-Infrastructure/5-Steps-to-Green-IT/.

The article states the importance of companies building Green IT solutions into their budgets and RFPs, not only for environmental reasons, but for significant savings.

It stresses that businesses need to create a recycling plan that will address how they dispose of obsolete equipment and to hold hardware vendors responsible for recycling and disposal. Sun Microsystems, Microsoft, and Apple are examples given that all have impressive e-waste reducing programs in place.

Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Twitter

Filed under: Miscellaneous | Posted on March 5th, 2010 by GregJ | No Comments »

Windows 7: Your PC, simplified

Microsoft asked its customers how they can improve Windows, and the outcome of their research is that it is now easier to use. It’s simple to find and manage files, and performance is faster and more reliable. Pearl Technology hosted a Microsoft 7 event on February 18 so we could show people how the new Windows 7 works through tutorials with our Microsoft experts and workstations to test it out. Visit http://www.pearltechnology.com/windows7/ for more information on that event.

Below are the Top 10 Windows 7 Improvements according to http://windows.microsoft.com:

1 A better desktop that lets you work faster. The taskbar has bigger buttons, full-sized previews, and allows for one-click access to programs. Jump Lists provide shortcuts to files, folders, and websites. And Snap, Peek, and Shake help juggle open windows.

2 Smarter search. Search results appear instantly, grouped by category, and you can narrow it with filters like date or file type—and be sure you get what you’re looking for with a preview pane.

3 Easy sharing of files and printers on your home network. With HomeGroup, you can connect two or more PCs running Windows 7, and share music, pictures, videos, and documents.

4 Built for speed. Windows 7 takes up less memory and runs background services only when necessary. Programs run faster and you can sleep, resume, and reconnect to wireless networks more quickly. Also includes 64-bit support.

5 Better wireless networking—it now takes just a couple of clicks to connect your laptop. Click on an available network in the taskbar and connect. Windows will remember your network connections so you can connect automatically the next time.

6 Windows Touch. Use your fingers to browse the web, flip through photos, and open files and folders on a touchscreen PC. Includes gestures for zooming, rotating, and even right-clicking.

7 Plays well with devices. Device Stage works like a home page for portable music players, smartphones, and printers. When plugged in, compatible devices make a menu appear with information popularly requested.

8 Improved media streaming. Windows Media Player 12 lets you enjoy your media library anywhere—from your PC to your stereo or TV (you may need additional hardware) or over the Internet from one computer running Windows 7 to another.

9 Live TV and movies on your PC. Internet TV gathers programming from sites all over the Internet. Add a TV tuner, and your PC becomes a digital video recorder you can use to watch, pause, and record live TV.

10 Nag-free notifications. Action Center puts you in control of maintenance and security messages. If Windows needs your attention, you’ll see a notification on the taskbar.

Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Twitter

Filed under: Miscellaneous | Posted on February 26th, 2010 by GregJ | 1 Comment »

Links

Topics

Tags

Authors

Syndication

Archives

Copyright © 2010 Pearl Technology. All rights reserved.
The Tech Blue theme was modified to help create this blog.