Thursday, September 22, 2011

Visual Studio Debugger Error: The web server process that was being debugged has been terminated by Internet Information Services (IIS). This can be avoided by configuring Application Pool ping settings in IIS. See help for further details.


STEP to fix this:
Run Internet Information Services (IIS) [ if you don’t know then follow the steps to find it.]

1.       Open the Administrative Tools window.

2.       Click Start and then choose Control Panel.

3.       In Control Panel, choose Switch to Classic View, if necessary, and then double-click Administrative Tools.

4.       In the Administrative Tools window, double-click Internet Information Services (IIS) Manager.

5.       In the Internet Information Services (IIS) Manager window, expand the node.

6.       Under the node, right-click Application Pools.

7.       In the Application Pools list, right-click the name of the pool your application runs in, and then click Advanced Settings.

8.       In the Advanced Settings dialog box, locate the Process Model section and chose one of the following actions:

 *.Set Ping Enabled to False.

—or—

*.Set Ping Maximum Response Time to a value greater than 90 seconds.

Explanation:

Setting Ping Enabled to False stops IIS from checking whether the worker process is still running and keeps the worker process alive until you stop your debugged process. Setting Ping Maximum Response Time to a large value allows IIS to continue monitoring the worker process.

9.       Click OK.

Wednesday, September 21, 2011

OWSTimer unhandled exception popup – System.Security.Cryptographic.CryptographicException


Here’s the resulting event log error:

An unhandled exception occurred and the process was terminated.
Application ID: DefaultDomain
Process ID: 6148
Exception: System.Security.Cryptography.CryptographicException
Message: Keyset does not exist
StackTrace: at System.Security.Cryptography.CryptographicException.ThrowCryptogaphicException(Int32 hr)
at System.Security.Cryptography.SafeProvHandle._FreeCSP(IntPtr pProvCtx)
at System.Security.Cryptography.SafeProvHandle.ReleaseHandle()
at System.Runtime.InteropServices.SafeHandle.InternalFinalize()
at System.Runtime.InteropServices.SafeHandle.Dispose(Boolean disposing)
at System.Runtime.InteropServices.SafeHandle.Finalize()

Cause of the error is when SharePoint 2010 and Visual Studio 2010 are both installed on the same machine you may see this error every 24 hours. This occurs when the OWSTimer service has a regular process recycle and in the shutdown of the old process an exception is raised. The exception doesn’t interfere with the normal process shutdown and recycle and is only ever seen if you have a JIT debugger installed on the machine.

You can ignore these exceptions and close the window.
You can stop the popup exception message by disabling JIT debugging on your machine. THIS WILL DISABLE JIT DEBUGGING FOR ALL APPLICATION ON THE MACHINE.

Follow the steps to configure the server  which will not show a dialog when an unhandled exception occurs, use the registry editor to delete the following registry keys:

· HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug\Debugger
· HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\DbgManagedDebugger

On a 64-bit operating system also delete the following registry keys:

· HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\AeDebug\Debugger
· HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\DbgManagedDebugger

More details on JIT Debugging are at:
http://msdn.microsoft.com/en-us/library/5hs4b7a6(VS.80).aspx

Wednesday, September 14, 2011

SharePoint Connection Error

--------------------
SharePoint Connection Error
--------------------
Cannot connect to the SharePoint Site: http://yoursharepointsite. Make sure that the site URL is valid, that the Sharrepoint si running on the local computer, and that the current user has the necessary permissions to access the site.

Additional information:

"Cannot connect to the SharePoint site: http://yoursharepointsite.. Make sure that this is a valid URL and the SharePoint site is running on the local computer. If you moved this project to a new computer or if the URL of the SharePoint site has changed since you created the project, update the site URL property of the project."




Resolution to this problem is.

1. Add current user as FARM administrator.
2. Add user as Site Collection administrator.
3. Give user permission on Database as DBO and DBO.OWNER on SharePoint_Config Database and site collection Content Database.

This will resolve the issue.

Friday, September 9, 2011

Show Quick Launch on SharePoint 2010 Custom Webpart Page

When you create a webpart page on SharePoint 2010 by default it will not have the quick launch will vanish.

All you needed to do is edit the page in SharePoint Designer and remove the following lines:


< asp:Content ContentPlaceHolderId="PlaceHolderNavSpacer" runat="server">
< asp:Content ContentPlaceHolderId="PlaceHolderLeftNavBar" runat="server">




You also need to delete the following:

< style type="text/css">
body #s4-leftpanel {
display:none;
}
.s4-ca {
margin-left:0px;
}


Done. Now refresh the page and the quick launch will now display on the web part page.

Thursday, August 25, 2011

Get DLL Out of The GAC

DLLs once deployed in GAC (normally located at c:\windows\assembly) can’t be viewed or used as a normal DLL file. They can’t be directly referenced from VS project. Developers usually keep a copy of the original DLL file and refer to it in the project at development (design) time, which uses the assembly from GAC during run-time of the project.

During execution (run-time) if the assembly is found to be signed and deployed in GAC the CLR automatically picks up the assembly from the GAC instead of the DLL referenced during design time in VS. In case the developer has deleted the original DLL or don't have it for some reason, there is a way to get the DLL file from GAC. Follow the following steps to copy DLL from GAC
  1. Run regsvr32 /u C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\yourdllname.dll
  2. yourdllname.ddl is an explorer extension DLL that gives a distinct look to the GAC folder. Unregistering this file will remove the assembly cache viewer and the GAC folder will be then visible as any normal folder in explorer.
  3. Open “%windir%\assembly\GAC_MSIL”.
  4. Browse to your DLL folder into the deep to find your DLL.
  5. Copy the DLL somewhere on your hard disk and refer it from there in your project
  6. Run "regsvr32 /i %windir%\Microsoft.NET\Framework\<.NET version directory> \yourdllname.dll" to re-register the shfusion.dll file and regain the original distinct view of the GAC.

Thursday, August 11, 2011

Add / Upload document to Document Library using SharePoint Object Model

Below is the code to upload document to SharePoint Document Library with all the metadata you wanted to update.


String fileToUpload = @"C:\FileNamePath.txt";
String sharePointSite = "http://urSharePointsite.com/sites/";
String documentLibraryName = "Shared Documents";

using
(SPSite oSite = new SPSite(sharePointSite))
{
   using
(SPWeb oWeb = oSite.OpenWeb())
   {
        SPFolder myLibrary = oWeb.Folders[documentLibraryName];

        //upload document
        String fileName = System.IO.Path.GetFileName(fileToUpload);
        FileStream fileStream = File.OpenRead(fileToUpload);

        // Upload document
        SPFile spfile = myLibrary.Files.Add(fileName, fileStream, true);

        SPListItem spLibItem = spfile.Item;


        spLibItem["Title"] = "Document Title";
        spLibItem["Field2"] = "Field2 Value";
        spLibItem.Update();
     }
}




Fetch user details based on user Alias/ Display Name and Update it to People or Group Field in List


The UserID relates to the ID of the user within the site collection. This is fine but the chances are that not all users are members of the site collection. To address this, the SharePoint OM has a handy little method called SPWeb.EnsureUser() which accepts a Login Name of a user as a string and first checks if the user exists in the site collection, if it does not then it adds the user and returns an SPUser object. Please be aware that you may need to set SPWeb.AllowUnsafeUpdates = True for this to work.
From the SPUser object it is very simple to get the ID (SPUser.ID.ToString() and SPUser.LoginName.ToString()) and then use simple string building to get the string in the right format for the ‘Person or Group’ field.

string sAllContacts = "";

using (SPSite site = new SPSite(“http://sites/site/yoursite”))
{
    site.AllowUnsafeUpdates = true;
    using (SPWeb web = site.RootWeb)
    {
        web.AllowUnsafeUpdates = true;
        string[] aAliases = sAliases.Split(';');
        foreach (string sAlias in aAliases)
        {
            SPUser user = web.EnsureUser(sAlias);
            sAllContacts += user.ID.ToString() + ";#" + user.LoginName.ToString() + ";#";
        }
        web.Update();
    }
}

Wednesday, August 3, 2011

Define managed paths (SharePoint Server 2010)

Published: May 12, 2010
By defining managed paths, you can specify which paths in the URL namespace of a Web application are used for site collections. You can specify that one or more site collections exists at a specified path. This can be a convenient method of consolidating multiple site access for users in various departments.
An explicitly named path (for example, http://server/sites/team) is used for a single site collection. A wildcard path of "sites" (for example, http://server/sites/) indicates that child URLs of the path are site collections.
In this article:

Tuesday, July 26, 2011

Lotus Notes Rich Text Migration to SharePoint Multiline RichText C#.Net DotNet


Currently I am working on the project where I need to migrate Lotus Notes data to sharepoint. I am able to find and migrate all the data using Domino API for .Net. I am facing problem when I am trying to migrate Lotus Notes RichText to SharePoint, It looses its formating and embedded images in the body.
Searching and investigating the approach to solve this problem.
I will keep you posted on this issue.

Friday, July 22, 2011

Developer Dashboard


The Developer Dashboard is an instrumentation framework introduced in Microsoft SharePoint Foundation 2010. Similar in concept to ASP.NET page tracing, it provides diagnostic information that can help a developer or system administrator troubleshoot problems with page components that would otherwise be very difficult to isolate. For example, a developer can easily introduce extra SPSite or SPWeb objects into his or her code unknowingly or add extraneous SQL Server queries.

In the past, the only way to debug performance problems caused by the extra overhead of these instances in code would be to attach a debugger to the code and monitor SQL Server Profiler traces. With the Developer Dashboard, a developer can identify this type of problem, either programmatically by using the object model or visually by looking at page output.

Although performance issues and resource usage information is available in the Unified Logging Service (ULS) logs, interpreting the raw data can be very time consuming. With the Developer Dashboard, all the related information is correlated, which makes identifying these types of issues much easier.

Friday, July 15, 2011

Problem Steps Recorder? ~ Capture Problem on Screen with all Narration.

You can use Problem Steps Recorder to automatically capture the steps you take on a computer, including a text description of where you clicked and a picture of the screen during each click (called a screen shot). Once you capture these steps, you can save them to a file that can be used by a support professional or someone else helping you with a computer problem.

Notes

When you record steps on your computer, anything you type will not be recorded. If what you type is an important part of recreating the problem you're trying to solve, use the comment feature described below to highlight where the problem is occurring.
Some programs, like a full-screen game, might not be captured accurately or might not provide useful details to a support professional.


  • To record and save steps on your computer Open Problem Steps Recorder - c:\Windows\System32\psr.exe. 
  • Click Start Record. On your computer, go through the steps on your computer to reproduce the problem. You can pause the recording at any time, and then resume it later.
  • Click Stop Record.
  • In the Save As dialog box, type a name for the file, and then click Save (the file is saved with the .zip file name extension). 
  • To view the record of the steps you recorded, open the .zip file you just saved, and then double-click the file. The document will open in your browser.

List Attachments over 50MB - increase in Maximum Upload Size

I came across problem during my migration project, where there were few mails in Lotus Notes which are having total size 99 MB and one of the attachment was of 65 MB training video.
Problem:
Default SharePoint settings not allow you to upload more than 50 MB file.
Goal:
Increase the maximum upload size for documents and attachments to 60MB for a web application.
Problem Solution:
  1. Open Central Admin
  2. Navigate to Central Admin > Application Management > Web Application General Settings
  3. Select web application for which you want to increase attachment size limit.
  4. Set the Maximum Upload Size value to 100 MB and hit OK.
Results:
  • Upload a 55MB video to a discussion- success.
  • Attach a 55MB file to a list item - receive the classic "An unknown error occurred" message, scratch head ~ that’s now pathetic.
There is a setting at the IIS level that will block list attachment uploads above 50MB. Below 50MB, works fine and is applied directly through web app settings. Above 50MB, you need to make at least one minor tweak to your web.config to allow larger uploads.
Complete solution for max upload sizes over 50MB:
  1. Connect to Central Admin
  2. Navigate to Central Admin > Application Management > Web Application General Settings
  3. Select your web application
  4. Set the Maximum Upload Size value to "X" (in our case its 100) MB and hit OK.
  5. Repeat steps 6-7 for all zones for your web application on all servers hosting the web application role
  6. Open the web.config
  7. Replace the following line:
    <httpRuntime maxRequestLength="51200" />
    with
    <httpRuntime maxRequestLength="{X * 1024}" />
  8. Still if this is not working then add executionTimeout="999999"

         <httpRuntime executionTimeout="999999" maxRequestLength="{X * 1024}" />

If you are using SQL storage for your SharePoint content, the maximum useful value for the maxRequestLength should be 2097152 (2GB in kilobytes = 2 * 1024 * 1024). Other limits may affect large uploads, most notably:
  • Site Collection Quota
  • Timeouts (you may need to adjust these in BOTH Web Application General Settings and the executionTimeout attribute of the <httpRuntime/> element)
    • Timeout settings will be influenced by network throughput limitations like latency and available bandwidth
  • Custom Storage Solution
    • External Blob Storage solution (see WSS SDK v1.3 for this feature that's new to WSS SP1) - whatever max BLOB size applies
  • Disk Space
    • If using SQL Storage, this is the disk containing your data files for your webapp's content DBs
    • If using an External Blob Storage solution, then this is wherever your blob store resides
For more on the httpRuntime web.config element, see http://msdn2.microsoft.com/en-us/library/e1f13641(VS.80).aspx .

Thursday, May 19, 2011

MOSS -You are not authorized to view this page.You do not have permission to view this directory or page using the credentials that you supplied.

MOSS -You are not authorized to view this page.You do not have permission to view this directory or page using the credentials that you supplied.



PROBLEM STATEMENT:

When I log onto my sharepoint site I was getting below message, This occurs when I try to log in to sharepoint site. As I was administrator I was able to access the site, but when I add user to sharepoint site:- Site Settings -> peoples and groups -> sitegroup -> add user (Domain User); After adding the users to the site group.

When newly added user tries to login to SharePoint site -> Site was giving following error.

You are not authorized to view this page

You do not have permission to view this directory or page using the credentials that you supplied.


--------------------------------------------------------------------------------

Please try the following:

Contact the Web site administrator if you believe you should be able to view this directory or page.

Click the Refresh button to try again with different credentials.

HTTP Error 401.1 - Unauthorized: Access is denied due to invalid credentials.

Internet Information Services (IIS)

--------------------------------------------------------------------------------

Technical Information (for support personnel)

Go to Microsoft Product Support Services and perform a title search for the words HTTP and 401.

Open IIS Help, which is accessible in IIS Manager (inetmgr), and search for topics titled Authentication, Access Control, and About Custom Error Messages.

SOLUTION:

After struggling a lot for whole 3 days – finally I thought of changing Service Account settings from the central admin.

I have made the changes to “Web Application Pool” settings to allow the Network Service accounts, which has resolved my problem.



Thursday, March 10, 2011

SharePoint Connections Session Follow Up: Create an Internet-Facing SharePoint Site

During the Create an Internet-Facing SharePoint Site session I covered the following topics.
  1. Setting up forms based authentication.
  2. Creating your own custom Master Pages and style sheets
  3. Personalizing site content for users.
  4. Leveraging the Business Data Catalog to surface and interact with back end systems.
  5. Each of these topics is broken down more in depth in this blog post. All the code used during my demos can be found in the rar file linked at the end of this post.
  6. Setting up forms based authentication
  7. Because a brief survey revealed almost the entire audience had already attended a session that covered setting up forms based authentication for SharePoint sites, I moved quickly through the materials related to setting up forms based authentication for SharePoint sites and did not spend a lot of time on it.

At any rate, here are the step by step instructions that describe how to set up a SharePoint site to use forms based authentication.
*Note: There are also several GREAT blog posts that describe how to set up FBA with SharePoint sites available on the Internet as well

SharePoint 2007 Performance Optimization

Recommendation: use x64 hardware on all servers to optimize page downloads by minimizing number of round trips between client computers and server computers.
Reason: With x64 you are not limited to 2 GB of Memory.
Benefit: Reduces network traffic and latency due to FE servers hitting the memory limit and needing to recycle.

Recommendation: apply Windows Server 2003 SP2
Reason: A list of all of the reasons can be found here: http://support.microsoft.com/kb/914962/en-us
Benefit: Optimizes the Front End server’s performance

Recommendation: Defragment the Front end Server’s drives
Reason: best practice for optimal disk performance
Benefit: Optimizes the Front End server’s performance


Recommendation: apply MOSS SP1 and post SP1 rollup fixes
Reason: The service packs addresses a lot of the known bugs that currently exist.
Benefit: Reduces network traffic and latency due to FE servers hitting the memory limit and needing to recycle.

Recommendation: Use a dedicated FE crawl target that is not in NLB (i.e. NLB is not installed)
Reason: By default, Office SharePoint Server 2007 uses all Web servers to crawl content in the server farm. When your server farm is configured to use all Web servers for crawling, the index server sends requests to each Web server in the farm.
Benefit: Crawling content in your farm places a heavy load on the Web servers. This tends to cause spikes and surges in network traffic, and is CPU-intensive and memory-intensive. By pointing to a dedicated FE server, users aren’t impacted negatively.

Recommendation: All server computers in the farm are on the same network segment. There is no switching in routers at the data layer. The network link between a Web server and the database server is less than 1 milliseconds (ms) latency and located 10 or fewer miles from the database server.
Reason: Routers and switches will increase latency even if the network connection between these is very fast. If the type of load the Web server is serving is some subset of user browse requests, we expect Office SharePoint Server 2007 to tolerate some latency between the Web server and the database server. On the other hand, pages with many or custom Web Parts, Stsadm commands, and search crawls are likely to fair less well.
Benefit: Reduces latency and provides a better experience for users in remote geographic locations

Recommendation: Do not use web gardens and BLOB cache at the same time
Reason: Because only one process can acquire the lock necessary to manage the cache, successful use the cache depends on which thread services a request. If a Web garden that does not have the BLOB cache lock services a request, the content it sends in response will not have caching directives associated with it.
Benefit: Reduces the amount of requests and data sent over the network by allowing BLOB Caching to work.

Recommendation: Optimize Blob Cache by including most used file extensions and increasing the cacheabilty value
Reason: The BLOB cache enables you to configure caching directives that are associated with items served from publishing site lists, for example, the Pages library and Site Collection Images. When the browser on the client computer encounters a caching directive, it detects that the item it is retrieving can be saved locally and does not need to be requested again until the caching directive expires. When the BLOB cache is turned on, a couple of different things happen. First, each time a cacheable item is requested, MOSS searches the hard disk drive of the Web server that received the request to see if a copy exists locally. If it does, the file is streamed directly from the local disk to the user. If it isn't on the local disk yet, a copy of the item is made from the SQL database where it is stored, and then the item is sent to the user making the request. From that point forward, all requests for the item can be served directly from the Web server until the item's cacheability value indicates that it has expired. The other thing it does is append a cacheability header to the item when the item is sent to the client. This header instructs the browser how long the item should be cached. For example, if a picture had a cacheability value of three days, the browser uses the copy of the image it has in its local cache if the picture is requested again within the next three days; it does not request it from the server again.
Benefit: That results in better performance in the server farm by reducing contention on the database server. In a geographically distributed environment, this is critically important because it reduces the number of items requested and sent over the network.

Please note that you need to ensure that the “Office Sharepoint Server Publishing” feature is activated on all Publishing sites. Also, you should update the location to the best performing drive, add in extra paths, and add in the max-age to expire based on your situation. For example:

Current setting: <BlobCache location="C:\blobcache" path="\.(gif|jpg|png|css|js)$ " maxSize="10" enabled="false"/>
Example Setting: <BlobCache location="E:\blobcache" path="\.(gif|jpg|png|css|js|htc|)$ " maxSize="10" max-age="86400" enabled="true"/>


Recommendation: Optimizing IIS Compression by changing the level of IIS compression from 0 to 9 and adding in certain dynamic files
Reason: When MOSS is installed, setup configures IIS to compress the static file types .htm, .html and .txt; it compresses the dynamic file types .asp and .exe. After a site has been hit by a few users, you can verify that compression is working by viewing the %WINDIR%\IIS Temporary Compressed Files directory on a Web server. It should contain multiple files, which indicates that static files have been requested and IIS has compressed a copy of them and stored them on the local drive. When that file is requested again, whether it's the same user or not, the compressed version of the file is served directly from this folder. Dynamic files can be compressed as well, but they are always compressed on the fly; copies are not kept on the local Web server. It may be advantageous to compress additional file types. For example, it probably makes sense to also compress the static file types .css and .js; it may also make sense to compress the dynamic file types .axd and .aspx.
Benefit: The IIS Compression can result in significant bandwidth savings. For example, the core.js file is included on every SharePoint page. When it's uncompressed, it is 257 KB; after compression, the file is only 54 KB without performing additional tuning to IIS compression.

Please note: Before applying IIS Compression, you will need to ensure that you only include files that are well-suited to being compressed. For example, .jpg files are not a good candidate for compression because the file format is inherently compressed already. Also, 2007 Microsoft Office system file types such as docx, xlsx and pptx are not a good choice for compression because the files are not served directly from the server; instead, they are routed through the different ISAPI filters that are used to manage the rich integrated end user experience for Microsoft Office content. In addition, in the 2007 Microsoft Office system, these file types are inherently compressed.

Ref: http://technet.microsoft.com/en-us/library/cc263099(office.12).aspx
and
http://blogs.technet.com/b/waynemo/archive/2008/03/19/moss-server-performance-considerations.aspx

Wednesday, March 9, 2011

MOSS Architecture and SSP

MOSS adopts a typical 3-tier model with web servers at the front, application servers in the middle and a database server at the back where all the data and config is stored.
The front-end web servers are simple web servers that can be network load balanced to achieve additional performance and fault tolerance (like 2003). The backend database is a typical SQL 2005 database service and can be clustered as you’d expect.
So what is different?
The interesting bit is what goes on in the middle. With MOSS, it is mandatory to have a Shared Service Provider. This is a collection of application servers that provide shared services out to any portals or sites that need them. These services include:
  • Search
  • Index
  • Audience compilation
  • User profiles database
  • My Sites
  • Business Data Catalogue
  • Excel Services
Any of the above services can exist on any number of servers within the SSP. For example, for a small-ish deployment you could have them all on one box, or you could scale them out onto different boxes as you see fit. There are no rules that govern where these services reside within the SSP or how many servers you have servicing them (with the exception of the Index server - only one per SSP). For example if you want 10 search servers – got for it ... “fill your boots” as we’d say here in England!
This model is very similar to the 2003 approach with one crucial difference,  the SSP has no portal affiliation. This means that you are not forced to have a specific parent/child style portal topology in order to use Shared Services which was one of the big sticking points with Sharepoint 2003 shared services.
So what does the ‘Portal’ actually do now?
For starters, it is now called ‘Collaboration Portal', not ‘portal’ and it is just another type of site collection that is hosted on an IIS site (called web applications in MOSS). Portals no longer contain any application services such as search, my site etc – all these services now have to come from an SSP. This means that all you need to host a portal is a web server and a place to put the content database.
Different portals can live on their own hardware which is completely isolated from any other hardware other than the fact that it consumes services from a centrally managed SSP. Alternatively, you can put some of your portals on shared hardware and some on dedicated.
I always hear requirements around different business units wanting their own portal which has its own visual style, custom webparts, different SLAs etc . With this model, there does not have to be any affiliation between any portals or sites if it is not required.
This diagram outlines the logic of how SSP provide services that are consumed by several site collections:
So does this mean that ‘Supported Farm configurations’ have gone?
In short, yes!
This model means that you can scale any element of the system out as you see fit. However, there are several recommended server layouts that will meet most scenarios. These broadly follow the small, medium and large models of Sharepoint 2003, but should be considered as starting points only. You can easily deviate to a different setup depending on your requirements.
So how does all this map to physical servers?
All three tiers (web, application, database) of the SharePoint model can be hosted on a single machine or scaled out to a huge collection of servers to meet the requirements.
Most organisations will want some level of fault tolerance and separation between server roles. Typically these kind of organisations will have at least 2 web servers running your portals and sites, at least one application server hosting all services (maybe a second for fault tolerance) and one database cluster. This diagram shows this model:
Larger organisations may want to have separate web servers for each of their portals, sites and my sites. They may also have multiple application servers as part of the SSP. This diagram describes this model:
I hope this was usefull.