1
votes

I got the web application working with facebooksdk and when i deployed it...it is running fine for sometime and it is throwing the error like this...

Server Error in '/' Application.

Could not load file or assembly 'Facebook, Version=4.1.1.0, Culture=neutral, PublicKeyToken=58cb4f2111d1e6de' or one of its dependencies. Access is denied. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.FileLoadException: Could not load file or assembly 'Facebook, Version=4.1.1.0, Culture=neutral, PublicKeyToken=58cb4f2111d1e6de' or one of its dependencies. Access is denied.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Assembly Load Trace: The following information can be helpful to determine why the assembly 'Facebook, Version=4.1.1.0, Culture=neutral, PublicKeyToken=58cb4f2111d1e6de' could not be loaded.

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

Stack Trace:

[FileLoadException: Could not load file or assembly 'Facebook, Version=4.1.1.0, Culture=neutral, PublicKeyToken=58cb4f2111d1e6de' or one of its dependencies. Access is denied.]
Secured_Login.FacebookVerification() +0
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25
System.Web.UI.Control.LoadRecursive() +71
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3048

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1

i got this method in pageload

protected void Page_Load(object sender, EventArgs e)
{
    FacebookVerification();
}

protected void FacebookVerification()
{
    try
    {
        FacebookApp fbApp = new FacebookApp();

        if (fbApp.Session != null)
        {
            dynamic myinfo = fbApp.Get("me");
            String firstname = myinfo.first_name;
            String lastname = myinfo.last_name;
            lblFBStatus.Text = "you signed in as " + firstname + " " + lastname ;
        }
        else
        {
            lblFBStatus.Text = "Please sign in with facebook";
        }
    }
    catch (Exception)
    {
        throw;
    }
}
1
It's not even getting that far. The error is "Access denied". Where are you trying to load the assembly from? What user is your application pool running as and what permissions do they have?Rup
The problem is...when in the development mode..there is no problem at all....but when i deployed it in iis..it is running fine for some time(like 20 min)...it is authenticating the user and retrieving the user info. But after some time it is throwing this error. i deployed it in windows server 2008. Greatly appreciated your help.Suren

1 Answers

0
votes

Have you tried the latest version of the C# Facebook SDK?