Zgjidhja për problemin: “FileNotFoundException” Me Marresit mia Feature.

I was working on a feature last week that would add some event receivers to a specific list instance. (Unë blogged një grimë në lidhje me atë receiver lista këtu).

Duke përdorur command line, Unë mund të instaloj funksion me asnjë gabim (por shih më poshtë për gabimin e fshehur). When I tried to deploy the feature on the site, MOSS complained of a "FileNotFoundException" gabim. This blog entry describes how I solved it.

Ky është gabim që MOSS tregoi mua në shfletuesin e internetit:

Feature ‘b2cb42e3-4f0a-4380-aaba-1ef9cd526f20’ could not be installed because the loading of event receiver assembly "xyzzyFeatureReceiver_0" dështuar: System.IO.FileNotFoundException: Could not load file or assembly ‘xyzzyFeatureReceiver_0’ ose njëri prej varësi të saj. Sistemi nuk mund të gjeni skedarin e specifikuar.
File name: ‘xyzzyFeatureReceiver_0’
at System.Reflection.Assembly.nLoad(AssemblyName filename, Codi batë String, AssemblySecurity Dëshmi, Kuvendi locationHint, StackCrawlMark& rafte tokës, Boolean throwOnFileNotFound, ForIntrospection Boolean)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, AssemblySecurity Dëshmi, StackCrawlMark& rafte tokës, ForIntrospection Boolean)
at System.Reflection.Assembly.InternalLoad(String assemblyString, AssemblySecurity Dëshmi, StackCrawlMark& rafte tokës, ForIntrospection Boolean)
at System.Reflection.Assembly.Load(String assemblyString)
at Microsoft.SharePoint.Administration.SPFeatureDefinition.get_ReceiverObject()
WRN: Kuvendi logging detyrues është fikur.
Për të mundësuar dështim kuvendit prerjeve lidhin, përcaktuar vlerën e regjistrit [HKLM Software Microsoft Fusion!EnableLog] (DWORD) në 1.
Shënim: Ka disa performanca dënimi shoqëruar me dështim prerjet e lidhnin kuvendit.
Për të aktivizuar këtë funksion off, hiqni vlerën e regjistrit [HKLM Software Microsoft Fusion!EnableLog].

Troubleshoot çështje me Windows SharePoint Services.

Unë e di se si për të qëllimisht shkaktojnë atë gabim: don’t install the assembly in the GAC. Por, it was in the GAC. I normally install assemblies into the GAC by dragging them into the c:\windows\assembly folder using windows explorer. I’ve never felt 100% rehat duke bërë që për shkak gjithmonë kam menduar se gacutil ekzistuar për një arsye … so I tried that. It made no difference.

Unë kontrolloi dhe gjeti Internets këtë post: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2243677&SiteID=1

Poster ka ndodhur të jetë duke përdorur pak njëjtën rrënjë të kodit (nga libri Inside UK nga kjo listë) so that was a hopeful sign. Megjithatë, Sugjerimi i kuvendit ujdisje me një [asamble: ] directive didn’t make sense to me. I tried it anyway and I was right. It made no difference.

Then I noticed that my class definition was not public. I made it public and that made no difference.

Tjetër, I went to the trouble of enabling the "assembly bind failure log" (ndjekur udhëzimet dobishme dhe të sakta të parashikuara) and this is where things started to get interesting. That log shows me that the runtime is searching everywhere on that server for my assembly. It even appears to be searching for it in my medicine cabinet. Por … ajo nuk do të kërkoni për atë në GAC.

I put on my winter jacket and go searching the Internets again and find that someone has had this problem too. The lengthy discussion in that posting peters off into nothing and I can’t find a solution.

I move my assembly into one of the places the log claims it’s searching and I make a little more progress. I’m rewarded with a new error in the browser when I try to activate the feature:

Failed to create feature receiver object from assembly "xyzzyFeatureReceiver_0", type "Conchango.xyzzyFeatureReceiver" për funksion b2cb42e3-4f0a-4380-aaba-1ef9cd526f20: System.ArgumentNullException: Vlera nuk mund të jetë null.
Emri Parametri: lloj
at System.Activator.CreateInstance(Lloji Lloji, Boolean jopublike)
at System.Activator.CreateInstance(Lloji Lloji)
at Microsoft.SharePoint.Administration.SPFeatureDefinition.get_ReceiverObject()

Troubleshoot çështje me Windows SharePoint Services.

Koha për një udhëtim të fundit në Internets!

Këtë herë kam gjetur, parashikueshme të mjaftueshme, that MOSS issues this error because the assembly is not in GAC.

Unë dua të dal nga diçka pozitive për këtë dhe të përpiqen për të ndjehen pak krenare që kam krijuar I arratisur nga kuvendet MSIL, but it’s not working. I’m just plain annoyed. I find myself muttering "chicken or the egg" nën frymën time.

I finally decide to punt. I create an entirely new project and copy/paste the code from the incredible-cloaked-from-the-GAC-assembly non-working project over to this new project. (I look for a build flag called something like "hide from assembly binding if installed in the GAC" por nuk mund të gjeni një).

Kam instaluar dhe aktivizuar atë funksion dhe … ajo punon! Kështu, pas të gjitha që, I had to basically ‘reboot’ my project. Kjo është një tjetër arsye pse unë e urrej kompjutera.

I did learn something useful from this. I had been installing features using the stsadm command line all day long and been using the "-force" option out of habit. Për disa arsye, I did not use the -force option when I installed the new project. Këtë herë, Unë e bëri në fakt, truly forget to copy this new project’s assembly into the GAC. Si rezultat, I received that "FielNotFoundException" gabim. Këtë herë, Kam marrë atë nga stsadm, not when I tried to activate the feature via the web browser. Kështu, -force actually plays two roles. It allows you to re-install an existing feature. It also allows you to install a buggy feature that cannot work at runtime by suppressing the error. It probably says as much in the help somewhere but I never noticed it.

</fund>

Technorati Tags: ,

3 mendime mbi "Zgjidhja për problemin: “FileNotFoundException” Me Marresit mia Feature.

  1. Francisco

    Edhe, Unë kisha mia 2 orët e nintendoSIXTYFOURRRR-in-a-keq-mënyrë histerik momentet kur unë riemëruar namespace në marrës Feature, për të ndihmuar në gjurmët ku juaji apo dikush tjetër filloi.

  2. Francisco

    Rrënja e problemit shtrihet në wsp të dislokuara në bazën e të dhënave SharePoint. Kam lexuar shkrimin tuaj dhe ndërsa ajo bën me të vërtetë të zgjidhur problemin ne kemi një zgjidhje të madhe me disa projekte dhe dhjetra e dosjeve kështu që çdo gjë lëviz nuk ishte një opsion.

    Pa marrë parasysh se sa shumë ju update Gac tuaj ose Asambleja juaj, çfarë është duke ju dhënë probleme është kuvendi në wsp tanishme instaluar në SharePoint.

    Ju mund të vërehet lehtë se duke u përpjekur për të vetëm të tërheqë zgjidhje (i cili është ku gabimi ndodh). Everything happening on "Retracting Time" should be considered "deployed wsp"-only not the project itself.

    Workaround im ishte:

    – Central admin: Cancel zgjidhje
    – stsadm: deletesolution
    – Visual Studio => Projekti => Paketë
    – stsadm: addsolution file-Projekti bin Debug Project.wsp
    – stsadm: deploysolution-name project.wsp-menjëhershme-allowgacdeployment-fuqi
    – Visual Studio => Vendosë

    Unë fshihet edhe dosjet bin dhe debug nga projekti para se të vendosë drejtimin përsëri, nuk mund të ketë ndonjë efekt, por vlerë komentuar.

    Kjo punon për të dy

    "Feature … nuk mund të instalohet për shkak të ngarkimit marrës kuvendit ngjarjes"
    dhe
    "Failed to create feature receiver object from assembly"

    Falënderim!
    Francisco

  3. Tom Clarkson

    Just spent a couple of hours trying to fix this same issue and found a better solution than simply recreating the project.

    It turned out that for some reason Visual Studio had set the build target to x86 instead of x64 or MSIL – the assembly was in the GAC, just not the same GAC that 64 bit SharePoint was looking in.

Lini një Përgjigju me Francisco Cancel përgjigje

Adresa juaj e emailit nuk do të publikohet. Fusha e kërkuar janë shënuar *