Lausn á vandamáli: “FileNotFoundException” Með Receiver eiginleiki minn.

I was working on a feature last week that would add some event receivers to a specific list instance. (Ég bloggaði aðeins um að lista móttakara hér).

Using the stjórn lína, Ég gæti sett aðgerðina án villa (en sjá hér fyrir falinn villa). When I tried to deploy the feature on the site, MOSS complained of a "FileNotFoundException" villa. This blog entry describes how I solved it.

Þetta er villa sem MOSS sýndi mér í vafranum:

Feature ‘b2cb42e3-4f0a-4380-aaba-1ef9cd526f20’ could not be installed because the loading of event receiver assembly "xyzzyFeatureReceiver_0" mistókst: System.IO.FileNotFoundException: Could not load file or assembly ‘xyzzyFeatureReceiver_0’ eða eitt af ósjálfstæði. The kerfi geta ekki finna the skrá sem tilgreind.
Skrá nafn: ‘xyzzyFeatureReceiver_0’
at System.Reflection.Assembly.nLoad(AssemblyName filename, String codebase, Sönnun assemblySecurity, Samkoma locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Sönnun assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(String assemblyString, Sönnun assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)
at Microsoft.SharePoint.Administration.SPFeatureDefinition.get_ReceiverObject()
WRN: Samkoma bindandi skógarhögg er slökkt.
Til að gera samkoma binda bilun skógarhögg, stilla skrásetning gildi [HKLM Software Microsoft Fusion!EnableLog] (DWORD) að 1.
Athugaðu: Það er einhver árangur refsing tengist samkoma binda bilun skógarhögg.
Til að kveikja þennan eiginleika af, fjarlægja skrásetning gildi [HKLM Software Microsoft Fusion!EnableLog].

Leysa mál með Windows SharePoint Services.

Ég veit hvernig á að vísvitandi valda þessi villa: don’t install the assembly in the GAC. En, 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% þægilegt að gera það vegna þess að ég hélt alltaf að gacutil verið fyrir ástæðu … so I tried that. It made no difference.

Ég leitaði internets og fann þessa færslu: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2243677&SiteID=1

Plakat varð að nota sömu rót hluti af kóða (innan frá WSS bók frá þessum lista) so that was a hopeful sign. Hins, tillögu að skreyta söfnuðinum með að [samkoma: ] 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.

Næsta, I went to the trouble of enabling the "assembly bind failure log" (fylgja gagnlegar og nákvæmar leiðbeiningar sem kveðið) 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. En … það mun ekki leita að því í 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" fyrir lögun b2cb42e3-4f0a-4380-aaba-1ef9cd526f20: System.ArgumentNullException: Gildi getur ekki verið tómt.
Viðfang nafn: tegund
at System.Activator.CreateInstance(Tegund gerð, Boolean eru almenn)
at System.Activator.CreateInstance(Tegund gerð)
at Microsoft.SharePoint.Administration.SPFeatureDefinition.get_ReceiverObject()

Leysa mál með Windows SharePoint Services.

Tími fyrir eitt síðasta ferð til Internets!

Þessi skipti sem ég fundið út, áreiðanlega nóg, that MOSS issues this error because the assembly is not in GAC.

Ég vil fá eitthvað jákvætt út úr þessu og reyna að finna smá stolt af því að ég hef búið á Landflótta af MSIL þingum, but it’s not working. I’m just plain annoyed. I find myself muttering "chicken or the egg" undir anda minn.

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" en getur ekki fundið einn).

Ég setja lögun og virkja það og … það virkar! Svo, eftir allt að, I had to basically ‘reboot’ my project. Þetta er önnur ástæðan af hverju ég hata tölvur.

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. For some reason, I did not use the -force option when I installed the new project. Í þetta sinn, Ég gerði í raun, truly forget to copy this new project’s assembly into the GAC. Þar af leiðandi, I received that "FielNotFoundException" villa. Í þetta sinn, Ég fékk það frá stsadm, not when I tried to activate the feature via the web browser. Svo, -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.

</enda>

Technorati Tags: ,

3 hugsanir á "Lausn á vandamáli: “FileNotFoundException” Með Receiver eiginleiki minn.

  1. Francisco

    Einnig, Ég hafði minn 2 klst af hysteric nintendoSIXTYFOURRRR-í-a-slæmur-vegur augnablik þegar ég endurnefna Nafnrými á Lögun Receiver, til að hjálpa lag þar þinn eða einhver annar er hófst.

    Svara
  2. Francisco

    Rót vandans liggur á vettvangi WSP í SharePoint gagnasafn. Ég las færslu þína og á meðan það er örugglega að leysa vandann sem við höfum mikla lausn með nokkrum verkefnum og heilmikið af skrá svo að flytja allt var ekki valkostur.

    Sama hversu mikið þú uppfærir GAG eða safnaðar yðar, hvað gefur þér vandræðum er samkoma í núverandi WSP uppsett á SharePoint.

    Þú getur auðveldlega tekið eftir því að með því að reyna að aðeins retract lausn (sem er þar sem villa kemur). Everything happening on "Retracting Time" should be considered "deployed wsp"-only not the project itself.

    Lausn minn var:

    – Central admin: Hætta lausn
    – stsadm: deletesolution
    – Visual Studio => Project => Pakki
    – stsadm: addsolution-skrá Project bin Debug Project.wsp
    – stsadm: deploysolution-nafn project.wsp-strax-allowgacdeployment-afl
    – Visual Studio => Dreifa

    Ég eyddi líka körfu og kemba möppur frá verkefninu áður hlaupandi senda aftur, gæti ekki hafa nein áhrif en þess virði athugasemd.

    Þetta virkar fyrir bæði

    "Feature … Ekki var hægt að setja vegna þess að hleðsla á atburði móttökutæki samkoma"
    og
    "Failed to create feature receiver object from assembly"

    Takk!
    Francisco

    Svara
  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.

    Svara

Leyfi svar við Francisco Hætta við svar

Netfangið þitt verður ekki birt. Nauðsynlegir reitir eru merktir *