Free Support Forum - groupdocs.com

Using an SQL Server database for the annotations


#1

Hello.


I have tried to store the annotations in an SQL server database instead of a compact database following these steps:

http://groupdocs.com/docs/display/annotationnet/How+to+use+GroupDocs+Annotation+for+.NET++with+MSSQL+Server

I have created the database and modified the connection string, but when the viewer loads I get a :

An object with the specified EntityKey value could not be found.

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.Data.ObjectNotFoundException: An object with the specified EntityKey value could not be found.

Source Error:

Line 124:                        var svc = ObjectFactory.GetInstance();
Line 125: string fileId = model.DocId + ‘.’ + model.DocType + “.pdf”;
Line 126: svc.AddCollaborator(fileId, "groupdocs@groupdocs.com", “Anonym”, “A.”, null); // allow anonymous users to annotate on a document
Line 127: }
Line 128: break;

We use Groupdocs.Web.Annotation version 1.2.2.8522 in an MVC project.
Do you have any idea what may be wrong?

If I remove the following code that produces the error:

var cookie = new HttpCookie(FormsAuthentication.FormsCookieName) { Expires = DateTime.UtcNow.AddDays(-1) };
Response.Cookies.Add(cookie);
Session.Abandon();

var svc = ObjectFactory.GetInstance<IAnnotationService>();
string fileId = model.DocId + ‘.’ + model.DocType + “.pdf”;
svc.AddCollaborator(fileId, "groupdocs@groupdocs.com", “Anonym”, “A.”, null); // allow anonymous users to annotate on a document

… IIS Express crashes.


Best Regards,
Kostas

#2

I have the impression that only the files that were added before the migration to SQL Server are not loading. When I add a new file it seems to work.

I have tried deleting the “temp” folder where the caching happens, but it didn’t help.
Is there anything besides the DB and the temp folder that keeps document information?

Best Regards,
Kostas

#3

Hello Kostas,

We are sorry to hear that you have such issue.

Again, I cannot reproduce it. The exception that you have is the most likely related to database access. You need to do all from scratch: clear all data from you database and delete the next files and folders in your local folder (App_Data by default): "temp" folder, file-sessions.json, groupdocs.annotation.collaborators.json, vs.bin. Also make sure that you connection string points to the SQL Server instance and not to the old SQL Compact DB.

Also I suggest you to explore this article "How to use GroupDocs.Annotation for .NET in an ASP.NET MVC 5 Project". It contains a lot of answer on your questions about structure, internal files and so on and thus it can shed light on future questions.

If you will have more questions please feel free to contact us.