Monday, January 16, 2012

Deploy DLL to Local app folder (Bin folder) in sharepoint 2010

I encouter an issue today. i need to implement a custom WebPart that wrap a custom asp.net control
that my company purchased from the third party.

if i deploy the custom WebPart to the GAC (which is by default for farm level deploy) it meams that
we had to deploy the third party DLL to the GAC as well. obviously this is a not good practice and very risky approach since we got the DLL without knowing anything as all the codes had been compile and package into the DLL.

After i google the web and found an excellent article from one of Sharepoint MVP Corey Roth

Deploying a Web Part with Code Access Security in Visual Studio 2010 (SP2010) 

I try make a very brief summary about how to solve the project DLL deployed to app folder instead of GAC (Global Assembly Cache) folder.

First we must change the assembly deployment target from GAC to WebApplication. when the project is deployed the project assembly will be deployed to the bin folder 
for my project, the DLLL is located at C:\inetpub\wwwroot\wss\VirtualDirectories\33499\bin

Second we need to add CAS (Code Access Security)Section to your solution section in the SharePoint package xml file.


finally when you compile and deploy your solution, you probably will encounter this following error
      
    Error occurred in deployment step 'Add Solution': Property set method not found.

 Microsoft already provide the hotfix  http://support.microsoft.com/kb/2022463

Friday, January 13, 2012

Overwite CSS inline style asp.net 4.0 Page in LookServer

Today, i got an issue after the look server is upgrade from 8.0 to 9.0, the asp.net engine had been changed from asp.net 2.0 to asp.net 4.0. the asp.net page had been render differently. those CSS classes still are available for the control. but the DataGrid which is rendered as a table had been use inline style to customize the look and they are overflow to cause the scroll bar enable. As the LookServer page only render window screen with ASP.net page. we had no control to modify those inline style customization.

Here is an example

<table style="z-index: 2; position: absolute; border-bottom-style: solid; border-bottom-color: #d4d0c8; border-right-style: solid; border-top-color: #808080; width: 811px; border-collapse: separate; border-top-style: solid; height: 266px; border-right-color: #d4d0c8; border-left-style: solid; border-left-color: #808080; cursor: default;" border="1" cellSpacing="0" cellPadding="0">

as the table had been specific the width in the inline style. this customization will cause the horizontal scroll bar to be enable since the table can't be fit into the frame with fixed width. if we change or overwrite the width with specific pixel to 100 percentage. then the table will automatically resize based on the size of host frame. as the result the table fit into the frame without any scroll bar.

the solution to solve the table overflow issue is

table[style]
{
   width:100% !important;
}


table is the HTML control that CSS will apply to.
Style is the element of HTML control that CSS will apply.
Width is the attribute that being apply.
!important is the rule that always apply


After i put the above rule in the CSS. the table overflow issue is fixed.

Thursday, January 5, 2012

how to fix "the web server "Your Web URL" did not appear to have sharepoint foundation installed"

i already got this issue when i try to open the website via SharePoint  Designer 2010

"the web server "My WebSite URL" did not appear to have SharePoint foundation installed"

it is so strange since i can open the website  and interact with it in the browser

I google it and found a solution from microsoft http://support.microsoft.com/kb/981223

just following steps that i directly copy from microsoft website,

"
  1. Start SharePoint 2010 Central Administration, and then click Security.
  2. Click Specify authentication providers.
  3. If the Web application in the Web Application list is not the same application that you want to open in SharePoint Designer 2010, click Web Application on the Change Web Application list.
  4. On the Select Web Application page, click the name of the Web application that you want to open.
  5. Under Zone, Click Default to open the Edit Authentication page.
  6. Under Enable Client Integration, click Yes, and then click Save.
"

Reminder: as mentioned by Microsoft, the root cause of this issue is that The Client Integration had been disable. Though my site setting show that Yes check is checked,  i click the save button and then open the website in SharePoint designer 2010 successfully, i believe there is some configuration error that cause the Client Integration had been disabled.  the setting display the incorrect setting. i had to save it again to overwrite the previous setting.

Wednesday, January 4, 2012

"HTTP Error 503. The service is unavailable." in sharepoint 2010

Today, i got a very weird issue in my sharepoint development server,

all SharePoint site including the central Administrative Portal suddenly did not work after i restart my IIS.

Here is the Errorr Message shown in the browser

"Error: Service Unavailable HTTP Error 503. The service is unavailable."

First  I check the applicaiton log there is no error found.
Second I went to the SharePoint  log file folder and check the SharePoint log. No Error had been Logged there.

Finally I found the following error in the IIS Log

"Application pool SharePoint Central Administration v4 has been disabled. Windows Process Activation Service (WAS) encountered a failure when it started a worker process to serve the application pool."

then i know that Central Administrative Portal failed due to the application pool stopped functioning.

I try to restart the app pool, but it failed again after i launch the central administrative portal. i thought the app pool might corrupt, then i used another app pool, but it failed immediately. when I try to create a new app pool to determine the issue, i found out that the service account had been expired, the root cause is that i forgot to set password of this service account never expired.


the solution is i reset the password of service account and check to make sure this password never expired. Then all the SharePoint site is back to normal and Central Administrative portal is functioning again.