Решение за проблемот: “FileNotFoundException” Со Мојот Функција ресивер.

I was working on a feature last week that would add some event receivers to a specific list instance. (Јас Blogged малку за таа листа приемник овде).

Користење на командната линија, Можев да го инсталирате функција без грешка (но видете подолу за скриени грешка). When I tried to deploy the feature on the site, MOSS complained of a "FileNotFoundException" грешка. This blog entry describes how I solved it.

Ова е грешка Мос Покажавме дека сме во веб прелистувачот:

Feature ‘b2cb42e3-4f0a-4380-aaba-1ef9cd526f20’ could not be installed because the loading of event receiver assembly "xyzzyFeatureReceiver_0" не: System.IO.FileNotFoundException: Could not load file or assembly ‘xyzzyFeatureReceiver_0’ или една од нејзините зависности. Системот не можат да најдат Наведената датотека.
Името на датотеката: ‘xyzzyFeatureReceiver_0’
at System.Reflection.Assembly.nLoad(AssemblyName Име, Стринг codebase, Докази assemblySecurity, Собранието locationHint, StackCrawlMark& магацинот почвата, Булова throwOnFileNotFound, Булова forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Докази assemblySecurity, StackCrawlMark& магацинот почвата, Булова forIntrospection)
at System.Reflection.Assembly.InternalLoad(Стринг assemblyString, Докази assemblySecurity, StackCrawlMark& магацинот почвата, Булова forIntrospection)
at System.Reflection.Assembly.Load(Стринг assemblyString)
at Microsoft.SharePoint.Administration.SPFeatureDefinition.get_ReceiverObject()
WRN: Собранието обврзувачки сеча е исклучен.
Да им се овозможи собранието се врзуваат неуспех сеча, поставите на вредноста во регистарот [HKLM Software Microsoft топење!EnableLog] (DWORD) да 1.
Имајте на ум: Има некои перформанси казна поврзан со собранието се врзуваат неуспех сеча.
За да го вклучите оваа функција исклучите, отстранете ја вредноста во регистарот [HKLM Software Microsoft топење!EnableLog].

Смена на проблеми со Windows SharePoint Services.

Знам како да намерно да предизвика оваа грешка: don’t install the assembly in the GAC. Но, 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% удобно прави тоа, бидејќи јас секогаш мислев дека gacutil постои причина … so I tried that. It made no difference.

Барав на Internets и го најде овој пост: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2243677&SiteID=1

На постерот се случи да биде со користење на ист корен малку на кодот (од внатре WSS книга од оваа листа) so that was a hopeful sign. Сепак, на предлог на украсување на собранието со [собранието: ] 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.

Следна, I went to the trouble of enabling the "assembly bind failure log" (по корисни и точни инструкции) 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. Но … тоа нема да го бара за него во 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" за функција b2cb42e3-4f0a-4380-aaba-1ef9cd526f20: System.ArgumentNullException: Вредност не може да биде нула.
Името на параметарот: тип
at System.Activator.CreateInstance(Тип тип, Булова се јавни)
at System.Activator.CreateInstance(Тип тип)
at Microsoft.SharePoint.Administration.SPFeatureDefinition.get_ReceiverObject()

Смена на проблеми со Windows SharePoint Services.

Време за една последна посета на на Internets!

Овој пат јас да дознаете, очекувано доволно, that MOSS issues this error because the assembly is not in GAC.

Сакам да добијам нешто позитивно од ова и обидете се да се чувствувам малку горд што сум ги создал Бегалецот од MSIL собранија, but it’s not working. I’m just plain annoyed. I find myself muttering "chicken or the egg" под мојот здив.

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" но не може да најде еден).

Јас го инсталирате функција и активирање на тоа и … таа работи! Така, по сето она што, I had to basically ‘reboot’ my project. Ова е уште една причина зошто мразам компјутери.

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. Поради некоја причина, I did not use the -force option when I installed the new project. Овој пат, Јас не, всушност,, truly forget to copy this new project’s assembly into the GAC. Како резултат на, I received that "FielNotFoundException" грешка. Овој пат, Земав од stsadm, not when I tried to activate the feature via the web browser. Така, -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.

</крајот>

3 размислувања за "Решение за проблемот: “FileNotFoundException” Со Мојот Функција ресивер.

  1. Francisco

    Исто така,, Имав мојот 2 часа на изненадување и запрепастеност nintendoSIXTYFOURRRR-во-а-лоши-начин моменти кога преименувана во Именски простор на функцијата ресивер, да им помогне на песна каде твое или некој друг почна.

  2. Francisco

    Коренот на проблемот лежи врз распоредени WSP во базата на податоци SharePoint. Јас го прочитав твојот пост и додека тоа навистина го поправат проблемот имаме огромен решение со неколку проекти и десетици датотеки, па движејќи се што не е опција.

    Без разлика колку ви обновете го вашиот GAC или вашиот собранието, она што е ви даваат проблеми е Собранието во тековната WSP инсталиран на SharePoint.

    Можете да лесно да се забележи дека со обидува само да повлече решението (кој е местото каде што грешка се случува). Everything happening on "Retracting Time" should be considered "deployed wsp"-only not the project itself.

    Мојата заобиколи беше:

    – Централна admin: Откажи решение
    – stsadm: deletesolution
    – Visual Studio => Проектот => Пакет
    – stsadm: addsolution-датотека проектот бин грешки Project.wsp
    – stsadm: deploysolution-име project.wsp-брзо-allowgacdeployment-сила
    – Visual Studio => Распоредување на

    Јас, исто така избришани бин и debug папки од проектот пред да го стартуваш распоредување повторно, не може да има никаков ефект, но вреди да коментираат.

    Ова работи и за

    "Feature … не може да се инсталира бидејќи вчитување на настанот приемник собранието"
    и
    "Failed to create feature receiver object from assembly"

    Благодарение!
    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.

Остави Одговори на Francisco Откажи одговор

Вашата е-маил адреса нема да бидат објавени. Задолжителни полиња се означени *