Solución: System.IO.FileNotFoundException en “SPSite = new SPSite(url)”

Actualización: Poño esta pregunta para MSDN aquí (http://forums.microsoft.com/Forums/ShowPost.aspx?PostID=2808543&SiteID=1&mode=1) and Michael Washam of Microsoft responded with a concise answer.

Eu creei un servizo web para actuar como un Fachada BDC-friendly to a SharePoint list. When I used this from my development environment, funcionou moi ben. Cando migrei este para un novo servidor, Eu atopei este erro:

System.IO.FileNotFoundException: A aplicación web en http://localhost/sandbox non puido ser atopada. Comprobe se inseriu a URL correctamente. Se a URL debe estar servindo contido existente, o administrador do sistema pode ter que engadir un novo mapeamento da URL da solicitude á aplicación desexada. en Microsoft.SharePoint.SPSite .. ctor(SPFarm Facenda, Uri requestUri, Booleana contextSite, SPUserToken userToken) en Microsoft.SharePoint.SPSite .. ctor(Cordas requestURL) en Conchango.xyzzy.GetExistingDocument(Cordas miniD, Cordas maxId, Secuencia de filtros título) en C:\Documents and Settings Galicia Os ​​meus documentos Visual Studio 2005 Projects xyzzy BDC_DocReview BDC_DocReview DocReviewFacade.asmx.cs:liña 69

Aquí é a liña 69:

utilización (Lugar SPSite = new SPSite("http://localhost/sandbox"))

Intento varias variacións sobre a URL, ata usar o nome real do servidor, o seu enderezo IP, barra ao final da URL, etc. I always got that error.

Eu soía Google to research it. Lots of people face this issue, ou variacións dela, pero ninguén parecía telo resolto.

Tricksy Moss solicitado un erro tan detallado que non se me ocorreu para comprobar o 12 hive logs. Eventualmente, sobre 24 horas despois meu compañeiro recomenda-me facelo, Eu comproba o 12 rexistro colmea e atopei este:

Unha excepción ocorreu durante o intento de adquirir a facenda local:
System.Security.SecurityException: Acceso ao rexistro solicitado non se admite.
en System.ThrowHelper.ThrowSecurityException(ExceptionResource recurso) en
(String nome, Booleana gravable) en
(String nome) en
() en
() en
(SPFarm& Facenda, Booleana& isJoined)
A Zona da assembly que non foi:  MyComputer

Isto abriu novos camiños de investigación, polo que estaba de volta a Google. Isto levoume a este foro post: http://forums.codecharge.com / posts.php?post_id = 67135. That didn’t really help me but it did start making me think there was a database and/or security issue. I soldiered on and Andrew Connell de post finally triggered the thought that I should make sure that the application pool’s identity account had appropriate access to the database. I thought it already did. Con todo, meu compañeiro foi e deu o app conta de identidade do pool acceso total ao SQL.

Así que fixo ese cambio, everything started working.

O que pasou despois é mellor expresada como un haiku poema:

Problemas levantar as mans.
You swing and miss. Try again.
Éxito! But how? ¿Por que?

Ela non quería deixar as cousas só, como que, preferindo dar permiso mínima necesaria (e, probablemente, con un ollo para escribir un post no blog; Eu batía nela co zócalo, muhahahahaha!).

Ela eliminou os permisos sucesivas da súa conta de identidade do pool de aplicacións ata … there was no longer any explicit permission for the app pool identity account at all. The web service continued to work just fine.

We went and rebooted the servers. Everything continued to work fine.

Así, para recapitular: we gave the app pool identity full access and then took it away. The web service started working and never stopped working. Bizarre.

Se alguén sabe por que isto debería funcionar, por favor, deixe un comentario.

</final>

Technorati Tags:

11 pensamentos sobre "Solución: System.IO.FileNotFoundException en “SPSite = new SPSite(url)”

  1. Fernando Gómez Flores

    Nice post, grazas. No meu caso, meu problema foi resolto cambiando apppool do webservice coincidindo co conxunto de sitios web do SharePoint.

    Saúde,
    Fernando A. Gómez F.

    Responder
  2. Wilson Edgar

    Ola, Eu tamén tiven o mesmo problema. Ao desenvolver na mesma máquina co servidor SharePoint, Eu estaba usando Asp servidor de desenvolvemento con permiso diferente, non certamente non funciona baixo a mesma identidade que SharePoint (máis sobre iso aquí: http://msdn.microsoft.com/en-us/library/58wxa9w5(VS.80).aspx) Entón, o que, Eu teño crear un novo sitio na IIS (porto 8080) coa mesma identidade como SharePoint.. e velada.
    Espero que isto axude

    Responder
  3. Zac Boyles
    Hai unha boa oportunidade de que o papel do servidor securityadmin de SQL corrixiu o problema que estaba tendo xa que el foi executado. Isto sería unha boa explicación para el seguir traballando.
    Responder
  4. Faery

    Nice writeup. We are having exactly the same issue right now. This kind of problem and unexpected/unexplained behaviour is exactly why a lot of developers cannot stand working with SharePoint!

    Responder
  5. Markus

    This part of the article….”gave the app pool identity account full access to SQL”, can you elaborate? “app pool identity” i presume means the app pool of the sharepoint site, pero “full access to SQL”, how do you give that? Creating a login on the db server for the app pool identity i think isn’t quite enough…so is it on the sharepoint content db where the new login gets dbo (?) access? Or other sharepoint db’s as well, like the config db? For me that’s tough, because my sp content db apparently isn’t handled by sql server instance, apparently it’s under “/Microsoft Office Servers/14.0/Data”, anyway i don’t see it in sql server mgr….any ideas how i give “full access to SQL” neste caso? Any reply would be appreciated…i’m kind stuck getting my console app to create an spsite object!!

    Responder

Deixe unha resposta Benjamin cancelar resposta

Enderezo de correo electrónico non será publicado. Os campos obrigatorios están marcados *