Error when converting to Web Application

Hi


I have a project that I have been trying to convert to WebApplication. I have managed to get everything to work except the page with Groupdocs.Annotations fails when calling:

var svc = ObjectFactory.GetInstance();

I get the following error and haven’t been able to find any solution for it:

Server Error in ‘/’ Application.

StructureMap Exception Code: 202
No Default Instance defined for PluginFamily Groupdocs.Web.Annotation.Security.IAuthenticationService, Groupdocs.Web.Annotation, Version=1.5.3.10477, Culture=neutral, PublicKeyToken=null

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: StructureMap.StructureMapException: StructureMap Exception Code: 202
No Default Instance defined for PluginFamily Groupdocs.Web.Annotation.Security.IAuthenticationService, Groupdocs.Web.Annotation, Version=1.5.3.10477, Culture=neutral, PublicKeyToken=null

Source Error:


Line 247: {
Line 248: _lblErrorText.Text = “Óvænt villa kom við að sækja skjal.”;
Line 249: return new WidgetFactory().Annotation();
Line 250: }
Line 251:

Source File: c:\Users\einar\Documents\Visual Studio 2012\Projects\OneMeetingPortalWebApp\DocumentViewer.aspx.cs Line: 249

Stack Trace:


[StructureMapException: StructureMap Exception Code: 202
No Default Instance defined for PluginFamily Groupdocs.Web.Annotation.Security.IAuthenticationService, Groupdocs.Web.Annotation, Version=1.5.3.10477, Culture=neutral, PublicKeyToken=null]
StructureMap.BuildSession.<.ctor>b__0(Type t) +244
StructureMap.Util.Cache`2.get_Item(KEY key) +269
StructureMap.BuildSession.CreateInstance(Type pluginType) +50
StructureMap.Container.GetInstance(Type pluginType) +88
StructureMap.Container.GetInstance() +112
StructureMap.ObjectFactory.GetInstance() +95
Groupdocs.Web.Annotation.AnnotationWidget…ctor() +49
Groupdocs.Web.Annotation.WidgetFactory.Annotation() +49
OneMeetingPortal.DocumentViewer.LoadDocumentInViewer() in c:\Users\einar\Documents\Visual Studio 2012\Projects\OneMeetingPortalWebApp\DocumentViewer.aspx.cs:249
ASP.documentviewer_aspx.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in c:\Users\einar\Documents\Visual Studio 2012\Projects\OneMeetingPortalWebApp\DocumentViewer.aspx:18
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +268
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
System.Web.UI.Page.Render(HtmlTextWriter writer) +29
OneMeetingPortal.Classes.PageTemplate.Render(HtmlTextWriter writer) in c:\Users\einar\Documents\Visual Studio 2012\Projects\OneMeetingPortalWebApp\Old_App_Code\PageTemplate.cs:124
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +9756550
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1386

When I try to deploy a working website version of the solution (i.e. it does work both in VS and on our own published local IIS) to our client’s testing server I get the following error, which seems to be also related to StructureMap:



Server Error in ‘/OneMeetingPortal3’ Application.
--------------------------------------------------------------------------------


StructureMap configuration failures:
Error: 170
Source: Registry: StructureMap.Configuration.DSL.Registry, StructureMap, Version=2.6.3.0, Culture=neutral, PublicKeyToken=e60ad81abae3c223
Unable to find the exported Type’s in assembly Groupdocs.Web.Annotation, Version=1.5.3.10477, Culture=neutral, PublicKeyToken=null. One or more of the assembly’s dependencies may be missing.

Could not load file or assembly ‘System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified.
System.IO.FileNotFoundException: Could not load file or assembly ‘System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified.
File name: ‘System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’
at System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes)
at System.Reflection.RuntimeAssembly.GetExportedTypes()
at StructureMap.Graph.TypePool.<>c__DisplayClass2.<.ctor>b__0(Assembly assembly)

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



-----------------------------------------------------------------------------------------------------


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: StructureMap.Exceptions.StructureMapConfigurationException: StructureMap configuration failures:
Error: 170
Source: Registry: StructureMap.Configuration.DSL.Registry, StructureMap, Version=2.6.3.0, Culture=neutral, PublicKeyToken=e60ad81abae3c223
Unable to find the exported Type’s in assembly Groupdocs.Web.Annotation, Version=1.5.3.10477, Culture=neutral, PublicKeyToken=null. One or more of the assembly’s dependencies may be missing.

Could not load file or assembly ‘System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified.
System.IO.FileNotFoundException: Could not load file or assembly ‘System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified.
File name: ‘System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’
at System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes)
at System.Reflection.RuntimeAssembly.GetExportedTypes()
at StructureMap.Graph.TypePool.<>c__DisplayClass2.<.ctor>b__0(Assembly assembly)

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



-----------------------------------------------------------------------------------------------------




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.

Stack Trace:



[StructureMapConfigurationException: StructureMap configuration failures:
Error: 170
Source: Registry: StructureMap.Configuration.DSL.Registry, StructureMap, Version=2.6.3.0, Culture=neutral, PublicKeyToken=e60ad81abae3c223
Unable to find the exported Type’s in assembly Groupdocs.Web.Annotation, Version=1.5.3.10477, Culture=neutral, PublicKeyToken=null. One or more of the assembly’s dependencies may be missing.

Could not load file or assembly ‘System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified.
System.IO.FileNotFoundException: Could not load file or assembly ‘System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified.
File name: ‘System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’
at System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes)
at System.Reflection.RuntimeAssembly.GetExportedTypes()
at StructureMap.Graph.TypePool.<>c__DisplayClass2.<.ctor>b__0(Assembly assembly)

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



-----------------------------------------------------------------------------------------------------


]
StructureMap.Diagnostics.GraphLog.AssertFailures() +85
StructureMap.Container.construct(PluginGraph pluginGraph) +295
StructureMap.ObjectFactory.Initialize(Action`1 action) +278
Groupdocs.Web.Annotation.WidgetFactory.(HttpContext , String , String , Boolean ) +184
ASP.global_asax.Application_Start(Object sender, EventArgs e) +283

[HttpException (0x80004005): StructureMap configuration failures:
Error: 170
Source: Registry: StructureMap.Configuration.DSL.Registry, StructureMap, Version=2.6.3.0, Culture=neutral, PublicKeyToken=e60ad81abae3c223
Unable to find the exported Type’s in assembly Groupdocs.Web.Annotation, Version=1.5.3.10477, Culture=neutral, PublicKeyToken=null. One or more of the assembly’s dependencies may be missing.

Could not load file or assembly ‘System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified.
System.IO.FileNotFoundException: Could not load file or assembly ‘System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified.
File name: ‘System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’
at System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes)
at System.Reflection.RuntimeAssembly.GetExportedTypes()
at StructureMap.Graph.TypePool.<>c__DisplayClass2.<.ctor>b__0(Assembly assembly)

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



-----------------------------------------------------------------------------------------------------


]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +12951237
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +175
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +304
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +404
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +475

[HttpException (0x80004005): StructureMap configuration failures:
Error: 170
Source: Registry: StructureMap.Configuration.DSL.Registry, StructureMap, Version=2.6.3.0, Culture=neutral, PublicKeyToken=e60ad81abae3c223
Unable to find the exported Type’s in assembly Groupdocs.Web.Annotation, Version=1.5.3.10477, Culture=neutral, PublicKeyToken=null. One or more of the assembly’s dependencies may be missing.

Could not load file or assembly ‘System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified.
System.IO.FileNotFoundException: Could not load file or assembly ‘System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified.
File name: ‘System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’
at System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes)
at System.Reflection.RuntimeAssembly.GetExportedTypes()
at StructureMap.Graph.TypePool.<>c__DisplayClass2.<.ctor>b__0(Assembly assembly)

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



-----------------------------------------------------------------------------------------------------


]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12968244
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +12807949



--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18446

The server wants me to install 'System.Web.Mvc assembly but the website is a simple ASP.NET Web Forms website.

Best regards
Robert Badi

We solved this same 202 issue by installing MVC 2 and MVC 3. Also had to change the web.config so that it matched the web.config structure in your dev environment. We just changed the paths and connection strings accordingly.

Hello Robert,

We are sorry to hear that you have this issue.

1. GroupDocs.Annotation for .NET requires ASP.NET MVC ver 3 or higher to be installed in any way, regardless on what type of project you are using. Yes, this may be considered as a drawback, we know this issue, but in the near future it is unlikely that this dependency will be removed. So you need to have installed ASP.NET MVC on the machine where GroupDocs.Annotation is using.

2. It’s hard for me to define what exactly was changed when converting a project from Web Site Project (WSP) to Web Application Project (WAP) (am I correct?). But at first you need to check all references and all libraries that are required by GroupDocs.Annotation for .NET. You can find all of required libraries in the “GroupDocs.Annotation C# Demos” package, in the “bin” folder. Here they are. (Some of them are SQL Server Compact related so if you are using SQL Server standard they are not required.) All of this should be present, be accessible for the project and there are should be correct references. Please, check this out.

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


Thank you dchambers. But MVC 4.0 is already running on our client’s webserver. Surely that should be enough. And now we are getting the following stack trace that says the requested .Net Framework Data Provider can not be found.


The thing is our solution with Groupdocs.Annotations works fine with Visual Studio on the built in server and when published to IIS locally. When we want to deploy to our client this comes up. See the following stack trace:

Unable to find the requested .Net Framework Data
Provider. It may not be installed.
<o:p></o:p>

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.ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed.

Source Error:

Line 17:

Line 16:

Line 18: <%= LoadDocumentInViewer() %>

Line 19:

Line 20:


Source File: c:\inetpub\wwwProcess\One\OneMeetingPortal\DocumentViewer.aspx Line: 18

Stack Trace:

[ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed.]

System.Data.EntityClient.EntityConnection.GetFactory(String providerString) +253

[ArgumentException: The specified store provider cannot be found in the configuration, or is not valid.]

System.Data.EntityClient.EntityConnection.GetFactory(String providerString) +11441804

System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString) +575

System.Data.Objects.ObjectContext..ctor(String connectionString, String defaultContainerName) +82

Groupdocs.Web.Annotation.[1].[1](IContext [1]) +133

StructureMap.Pipeline.LambdaInstance`1.build(Type pluginType, BuildSession session) +65

[StructureMapException: StructureMap Exception Code: 207

Internal exception while creating Instance '57c7c7eb-e752-4a10-9819-3cfc22a258c1' of PluginType Groupdocs.Data.ISaasposeDb, Groupdocs.Web.Annotation, Version=1.5.3.10477, Culture=neutral, PublicKeyToken=null. Check the inner exception for more details.]

StructureMap.Pipeline.LambdaInstance`1.build(Type pluginType, BuildSession session) +224

StructureMap.Pipeline.Instance.createRawObject(Type pluginType, BuildSession session) +87

StructureMap.Pipeline.Instance.Build(Type pluginType, BuildSession session) +50

StructureMap.Pipeline.ObjectBuilder.Resolve(Type pluginType, Instance instance, BuildSession session) +147

StructureMap.BuildSession.CreateInstance(Type pluginType, Instance instance) +72

StructureMap.BuildSession.CreateInstance(Type pluginType) +23

StructureMap.Pipeline.Instance.createRawObject(Type pluginType, BuildSession session) +87

StructureMap.Pipeline.Instance.Build(Type pluginType, BuildSession session) +50

StructureMap.Pipeline.ConstructorInstance.Get(String propertyName, BuildSession session) +86


Hi Denis


Yes you are correct about the WSP to WAP conversion.

Your first point explains the problem on our client’s testing server.

As to the second point I have added the dll’s that were missing (only two apart from the sql related ones). When I try to add them I get the error

"A reference to ‘C:\Users\einar\Documents\Visual Studio 2012\Projects\OneMeetingPortalWebApp\lib\sqlcese40.dll’ could not be added. Please make sure that the file is accessible, and that it is a valid assembly or COM component."

Those dll’s I copied straight from the “C:\Program Files (x86)\GroupDocs\Annotation 1.5.0 for .NET\bin” folder.

Even with the two dll’s that I added I get the same errors (see the first post).




Hello Robert,

Because several issues are raised and discussed here, I’ll follow them step by step.

1. About ASP.NET MVC. Yes, as I said before, GroupDocs.Annotation for .NET requires ASP.NET MVC ver 3 or above to be installed. We successfully tested it with MVC 3, 4 and 5. But this doesn’t mean that GroupDocs.Annotation will automatically find available System.Web.Mvc and will use it. As any other .NET assembly that is used in the Visual Studio project, GroupDocs.Annotation uses the version which is specified in the References of the project. So, if in your project the reference is pointing to the System.Web.Mvc.dll version 3.0.0.0, but you have installed only MVC 4, this will not be working. Also you need to check the web.config because in WSP all assemblies are usually specified in the configuration->system.web->compilation->assemblies, for example . If you have MVC 3 project, but want to use MVC 4, I can suggest to use this article: ASP.NET MVC 4. Upgrading an ASP.NET MVC 3 Project to ASP.NET MVC 4.

2. Libraries sqlceca40.dll, sqlcecompact40.dll, sqlceer40EN.dll, sqlceme40.dll, sqlceoledb40.dll, sqlceqp40.dll, sqlcese40.dll and System.Data.SqlServerCe.Entity.dll are not classic .NET assemblies and you cannot add the references to them. They are required only when you are using SQL Server Compact - you need to add them to the “bin” folder so GroupDocs.Annotation will be able to find and use them in the real-time. I was talking about all others assemblies which are required and should be referenced:

StructureMap.dll
DocumentFormat.OpenXml.dll
Microsoft.AspNet.SignalR.Core.dll
Microsoft.AspNet.SignalR.Owin.dll
Microsoft.AspNet.SignalR.SystemWeb.dll
Microsoft.Owin.Host.SystemWeb.dll
Owin.dll

3. The core reason of all of these errors I see in the phrase “our solution with Groupdocs.Annotations works fine with Visual Studio on the built in server and when published to IIS locally”. If you are able to run Groupdocs.Annotations on local IIS without errors, and errors occur on remote machine, then that means that IIS on remote machine is configured improperly, or there is a lack of some required libraries. I think that “Unable to find the requested .Net Framework Data Provider” exception is also related to this reason.

You need to check which .NET framework version you have installed on your machine, which additional libraries, and which version your project uses. As I remember, when using MVC 3 and 4 can be created with both Framework 4.0 and 4.5, while MVC 5 requires only Framework 4.5. Also make sure that there is a Full trust level on remote IIS. Also you need to enable Full permission for the “App_Data” folder. One more thing, that you wrote me via PM - that publish process corrupts the web-site.

In fact, I don’t know exact configuration of your client’s remote machine, so I cannot give you an exact advice like what exactly you need to do in order to make it work. You need to compare your own machine’s configuration with remote machine and find that difference, which is the reason of these errors. From my side I can say that GroupDocs.Annotation is 100% compatible with IIS; for example, here we have Annotation 1.6 running on IIS 7.5.


Waiting for your feedback.

oh, and I was just told that our client had installed MVC version 4.0 so I checked again and we still get this error. You said that we need MCV version 3 and up, right?:



Server Error in ‘/OneMeetingPortal3’ Application.
--------------------------------------------------------------------------------

StructureMap configuration failures:
Error: 170
Source: Registry: StructureMap.Configuration.DSL.Registry, StructureMap, Version=2.6.3.0, Culture=neutral, PublicKeyToken=e60ad81abae3c223
Unable to find the exported Type’s in assembly Groupdocs.Web.Annotation, Version=1.5.3.10477, Culture=neutral, PublicKeyToken=null. One or more of the assembly’s dependencies may be missing.

Could not load file or assembly ‘System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified.
System.IO.FileNotFoundException: Could not load file or assembly ‘System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified.
File name: ‘System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’
at System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes)
at System.Reflection.RuntimeAssembly.GetExportedTypes()
at StructureMap.Graph.TypePool.<>c__DisplayClass2.<.ctor>b__0(Assembly assembly)

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

-----------------------------------------------------------------------------------------------------

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: StructureMap.Exceptions.StructureMapConfigurationException: StructureMap configuration failures:
Error: 170
Source: Registry: StructureMap.Configuration.DSL.Registry, StructureMap, Version=2.6.3.0, Culture=neutral, PublicKeyToken=e60ad81abae3c223
Unable to find the exported Type’s in assembly Groupdocs.Web.Annotation, Version=1.5.3.10477, Culture=neutral, PublicKeyToken=null. One or more of the assembly’s dependencies may be missing.

Could not load file or assembly ‘System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified.
System.IO.FileNotFoundException: Could not load file or assembly ‘System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified.
File name: ‘System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’
at System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes)
at System.Reflection.RuntimeAssembly.GetExportedTypes()
at StructureMap.Graph.TypePool.<>c__DisplayClass2.<.ctor>b__0(Assembly assembly)

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

-----------------------------------------------------------------------------------------------------

Source Error:

Line 10: Groupdocs.Web.UI.Viewer.SetRootStoragePath(ConfigurationManager.AppSettings[“GroupDocsTempStoragePath”]);
Line 11: Groupdocs.Web.UI.Viewer.EnableFileListRequestHandling(false);
Line 12: Groupdocs.Web.Annotation.WidgetFactory.Initialize(this.Context, @“~/App_Data”);
Line 13: }
Line 14:
Source File: c:\inetpub\wwwroot\OneMeetingPortal3\Global.asax Line: 12

Stack Trace:

[StructureMapConfigurationException: StructureMap configuration failures:
Error: 170
Source: Registry: StructureMap.Configuration.DSL.Registry, StructureMap, Version=2.6.3.0, Culture=neutral, PublicKeyToken=e60ad81abae3c223
Unable to find the exported Type’s in assembly Groupdocs.Web.Annotation, Version=1.5.3.10477, Culture=neutral, PublicKeyToken=null. One or more of the assembly’s dependencies may be missing.

Could not load file or assembly ‘System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified.
System.IO.FileNotFoundException: Could not load file or assembly ‘System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified.
File name: ‘System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’
at System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes)
at System.Reflection.RuntimeAssembly.GetExportedTypes()
at StructureMap.Graph.TypePool.<>c__DisplayClass2.<.ctor>b__0(Assembly assembly)

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

]
StructureMap.Diagnostics.GraphLog.AssertFailures() +85
StructureMap.Container.construct(PluginGraph pluginGraph) +295
StructureMap.ObjectFactory.Initialize(Action`1 action) +278
Groupdocs.Web.Annotation.WidgetFactory.(HttpContext , String , String , Boolean ) +184
ASP.global_asax.Application_Start(Object sender, EventArgs e) in c:\inetpub\wwwroot\OneMeetingPortal3\Global.asax:12

[HttpException (0x80004005): StructureMap configuration failures:
Error: 170
Source: Registry: StructureMap.Configuration.DSL.Registry, StructureMap, Version=2.6.3.0, Culture=neutral, PublicKeyToken=e60ad81abae3c223
Unable to find the exported Type’s in assembly Groupdocs.Web.Annotation, Version=1.5.3.10477, Culture=neutral, PublicKeyToken=null. One or more of the assembly’s dependencies may be missing.

Could not load file or assembly ‘System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified.
System.IO.FileNotFoundException: Could not load file or assembly ‘System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified.
File name: ‘System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’
at System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes)
at System.Reflection.RuntimeAssembly.GetExportedTypes()
at StructureMap.Graph.TypePool.<>c__DisplayClass2.<.ctor>b__0(Assembly assembly)

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

-----------------------------------------------------------------------------------------------------

]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +12951237
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +175
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +304
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +404
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +475

[HttpException (0x80004005): StructureMap configuration failures:
Error: 170
Source: Registry: StructureMap.Configuration.DSL.Registry, StructureMap, Version=2.6.3.0, Culture=neutral, PublicKeyToken=e60ad81abae3c223
Unable to find the exported Type’s in assembly Groupdocs.Web.Annotation, Version=1.5.3.10477, Culture=neutral, PublicKeyToken=null. One or more of the assembly’s dependencies may be missing.

Could not load file or assembly ‘System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified.
System.IO.FileNotFoundException: Could not load file or assembly ‘System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified.
File name: ‘System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’
at System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes)
at System.Reflection.RuntimeAssembly.GetExportedTypes()
at StructureMap.Graph.TypePool.<>c__DisplayClass2.<.ctor>b__0(Assembly assembly)

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

-----------------------------------------------------------------------------------------------------
]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12968244
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +12807949
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18446

Hi Denis


Thank you for these points. We have now managed to solve all the deployment problems with the help of this information and lots of googling and experimenting.

The only thing we have not figured out is the 202 error that I posted first. But that was not related to deployment but was an experiment to see if a WebApp would work better. I have checked and re-checked that we have all dll’s and refrenced correct but I see nothing missing there. If you have any ideas regarding that one they would be greatly appreciated. This however is not a showstopper.

Greetings
Robert Badi

Hello Robert,

I’m glad that all major issues were resolved. About StructureMap 202: have you checked a trust level on remote IIS web-server, as I mentioned in my last post at this thread?

Hi Denis


No, I haven’t tried that as the 202 error comes when I run the project as a web application in Visual Studio on the built in server so that shouldn’t be necessary. Unless I am mistaken of course.

Robert Badi


Hello Robert,

Got it. Please try one more thing.

Instead the

IAnnotationService svc = StructureMap.ObjectFactory.GetInstance();

Please use the next block of code, which performs the same but without StructureMap:

using Groupdocs.Annotation;
using Groupdocs.Api.Contract;
using Groupdocs.Common;
using Groupdocs.Core;
using Groupdocs.Data;
using Groupdocs.Data.MsSql.Account;
using Groupdocs.Data.MsSql.Annotation;
using Groupdocs.Web.Annotation.Security;
using Groupdocs.Web.Annotation.SignalR;
using Groupdocs.Web.Annotation.Utils;
using AnnotationService = Groupdocs.Web.Annotation.AnnotationService;
using IAnnotationService = Groupdocs.Web.Annotation.IAnnotationService;

.........
.........

ISaasposeDb i1 = new SaasposeDb(System.Configuration.ConfigurationManager.ConnectionStrings["SaasposeDb"].ToString());
AuthenticationService au_ser= new AuthenticationService();
AnnotationBroadcaster ab = new AnnotationBroadcaster(new AnnotationHub(au_ser));
UserService u_ser = new UserService(new UserRepository(i1));
Annotator ann = new Annotator(
u_ser,
new AnnotationSessionService(new AnnotationSessionRepository(i1)),
new Groupdocs.Core.AnnotationService(new AnnotationRepository(i1)),
new AnnotationReplyService(new AnnotationReplyRepository(i1)),
new AnnotationCollaboratorService(new AnnotationCollaboratorRepository(i1)),
new AnnotationLayerService(new AnnotationLayerRepository(i1))
);
Groupdocs.Web.Annotation.AnnotationService asvc = new AnnotationService(ab, au_ser, u_ser, ann);
asvc.AddCollaborator(...........);


And then trace where the exception will raise and will it raise at all.

Thanks. Waiting for your response.

Hi Denis


First I got an error because reference to System.Data.Entity version 4.0.0.0 was missing.

After fixing that I get an error when calling the following line:

AuthenticationService au_ser = new AuthenticationService();

I get the following exception:

StructureMap Exception Code: 202
No Default Instance defined for PluginFamily Groupdocs.Web.Annotation.Security.IAuthenticationService, Groupdocs.Web.Annotation, Version=1.5.0.10317, Culture=neutral, PublicKeyToken=null

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: StructureMap.StructureMapException: StructureMap Exception Code: 202
No Default Instance defined for PluginFamily Groupdocs.Web.Annotation.Security.IAuthenticationService, Groupdocs.Web.Annotation, Version=1.5.0.10317, Culture=neutral, PublicKeyToken=null

I hope this helps.

Greeting
Robert Badi

Hello Robert,

Thanks for the additional info. I need you to try/investigate one more thing. I’ve discussed all of these with GroupDocs.Annotation developers intensively, and here is a couple of thoughts/suggestions:

1. GroupDocs.Annotation contains and internally uses StructureMap. The described situation may occur when you are trying to open a document before GroupDocs.Annotation was initialized. Please check where do you have a

Groupdocs.Web.Annotation.WidgetFactory.Initialize(this.Context, @"~/App_Data");

and are you sure that it is invoked before all other GroupDocs.Annotation-related code?

2. If yes, please remove all the code that I’ve suggested you in the previous post and also remove the

IAnnotationService svc = StructureMap.ObjectFactory.GetInstance();

svc.AddCollaborator(Filename, "groupdocs@groupdocs.com", “AnonymFirstName”, “AnonymLastName”, null);

Just try to open GroupDocs.Annotation-related web-page without these two lines of code. What you will see? Will there be GroupDocs.Annotation GUI, or document too, or some messages/errors, or exception?


Thanks. Waiting for your response.

Hello Denis


No, the Initialize function is not run for some reason. I set a breakpoint into Application_Start in Global.asax but it never ran. I thought it might be because of the conversion so I threw out Global.asax (deleted it) and added a fresh Global.asax file in Visual Studio (Add new Item, Ctrl+Shift+A) and this time I got a code behind for it.

I added the same lines to this new file in Application_Start and put a breakpoint in the same place and run the programme and the breakpoint never hits. So this initializing function does not run.

Now why that happens I don’t know. Any ideas?

Greetings
Robert Badi

Hello Robert,

Thanks for the immediate answer. Now the reason of this error is absolutely clear. “WidgetFactory.Initialize” method initializes StructureMap bindings inside the GroupDocs.Annotation, so that’s why you have this exception.

There might be different reasons why “Application_Start” method is not firing. I’ve found a lot of different QA, notes and articles which are related to this widespread problem. But at first want you to check do you have a in the web.config.

In any case, this is not an irresistible issue. “WidgetFactory.Initialize” method doesn’t require to be called especially from the Global.asax. Actually, you can call it wherever and whenever you want, the only requirement - this initialization should be done before the first use of the all other GroupDocs.Annotation-related stuff.

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

Hi Denis


Yes I have this line in Web.config you mentioned.

I tried to run the initialization in the page_load method on the page and then I get the viewer up and everything works as it is supposed to.

I have also seen lots of pages about this Global.asax error, but no solution has worked so far.

Thank you very much Denis for all your work. I think this problem is solved.

Best regards
Robert Badi