Visual Studio 2010 개발 툴에서 SharePoint 2010 개발 시,

SPSite 객체를 가져오는데 아래와 같은 FileNotFoundException이 발생하여 당황스럽게 하는 경우가 있습니다. (사이트는 실제로 존재) 


실행 소스

using (SPSite site = new SPSite("http://shing208"))

using (SPWeb web = site.OpenWeb()) { }

 

에러 메시지

FileNotFoundException

The Web application at http://shing208 could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application.

 

원인 및 해결책(체크 사항)

SharePoint 2010 버전은 64비트만 지원하는데, 개발 진행시 빌드 옵션 사항이 32비트로 지정되어 있어 발생하였습니다.

해결 방법은 아래 이미지와 같이 프로젝트 속성으로 들어가, 빌드 플랫폼 타켓을 x64로 변경해주시면 됩니다.

                 

 

  


Visual Studio 웹 사이트 및 웹 응용 프로그램 타입의 프로젝트를 생성하여
Visual Studio 가상 서버를 이용한 빌드가 아닌, 아래와 같이 사용자 지정 서버 사용을 이용하여 빌드가 가능하다.




이 때, 디버깅 관련 오류가 뜨는 경우가 있다.
그 해결법으로...

1. 루프백 확인 비활성화
  • 시작, 실행을 차례로 누르고 regedit를 입력한 다음 확인누른다.
  • 레지스트리 편집기에서 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa 레지스트리 키를 찾아 누른다.
  • Lsa를 마우스 오른쪽 단추로 누르고 새로 만들기를 가리킨 다음 DWORD 값을 누른다.
  • DisableLoopbackCheck를 입력한 다음 Enter 키를 누른다.
  • DisableLoopbackCheck를 마우스 오른쪽 단추로 누른 다음 수정을 누른다.
  • 값 데이터 상자에 1을 입력한 다음 확인을 누른다.
  • 레지스트리 편집기를 종료하고 컴퓨터를 다시 시작한다.


2. 호스트 이름 지정방법
   루프백 주소에 매핑되며 사용자 컴퓨터의 웹 사이트에 연결할 수 있는 호스트 이름을 지정하려면 다음과 같이 하면 된다.

  • 시작, 실행을 차례로 누르고 regedit를 입력한 다음, 확인을 누른다.
  • 레지스트리 편집기에서 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0의 레지스트리 키를 찾아 누른다.
  • MSV1_0을 마우스 오른쪽 단추로 누르고 새로 만들기를 가리킨 다음 다중 문자열 값을 누른다.
  • BackConnectionHostNames를 입력한 다음 Enter 키를 누른다.
  • BackConnectionHostNames를 마우스 오른쪽 단추로 누른 다음 수정을 누른다.
  •  값 데이터 상자에서 로컬 컴퓨터에 있는 사이트의 호스트 이름을 하나 또는 여러 개 입력 한 후 확인을 누른다.
  • 레지스트리 편집기를 끝낸 다음 IISAdmin 서비스를 다시 시작한다.

       

SharePoint under the hood - see real error description and callstack/stack trace 
I have always loved the nice SharePoint error messages that are presented when something goes wrong. My most popular error message is "An unknown error occured. Please contact your system administrator.".
 
In order to see the real error messages as well as the stack trace of where the error happened within SharePoint, you have to do two simple things - in fact, this is mainly standard ASP.NET business:
 
In the web.config file of your SharePoint web application, edit these two entries:
 
1. Switch custom errors off
<system.web>
...
<customErrors mode="On" />
...
</system.web>


Set the value "On" to "Off" in a development or staging environment, or to "RemoteOnly" if you have to troubleshoot an issue in a productive environment (of course, the error has to be reproduced locally in this case).
 
2. Enable CallStack
<SharePoint>
...
<SafeMode MaxControls="50" CallStack="false" />
...
</SharePoint>
 
To make the CallStack visible, set the value to "true".
 
Please note that changing the web.config will cause SharePoint to restart the whole web application immediately after saving.

   1: <configuration>
   2:   <SharePoint>
   3:     <SafeMode CallStack="true" />
   4:    </SharePoint>
   5:   <system.web>
   6:     <customErrors mode="Off" />
   7:     <compilation debug="true" />
   8:   </system.web>
   9: </configuration>

 

+ Recent posts