Unable To Load The Seagull.bartender.print Using Asp.net 4.0 フォローする

0
Avatar
Legacy Poster

I am able to print the labels only using the VS2010 debugger but when I deployed the application to IIS on Windows 7.
When I am browsing my localhost/more1, I am getting this error.

I just need to load the Seagull.BarTender.Print.dll correctly.

Please advise.


Server Error in '/more1' Application.

Retrieving the COM class factory for component with CLSID {B9425246-4131-11D2-BE48-004005A04EDF} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).

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.UnauthorizedAccessException: Retrieving the COM class factory for component with CLSID {B9425246-4131-11D2-BE48-004005A04EDF} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).

ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6 and IIS 7, and the configured application pool identity on IIS 7.5) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.

To grant ASP.NET access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.

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:


[UnauthorizedAccessException: Retrieving the COM class factory for component with CLSID {B9425246-4131-11D2-BE48-004005A04EDF} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).]
Seagull.BarTender.Print.Engine.Start(EngineSettings engineSettings) +313

[PrintEngineException: The BarTender engine could not be started. Possible reasons are:

1) BarTender is not properly installed.
2) BarTender is not properly registered on the computer (e.g bartend.exe /register).
3) There are too many process instances of BarTender running. Stop a few bartend.exe instances and try again. Also see SDK Engine.Start method documentation for information about how to allow more BarTender processes to run on your computer by increasing your "non-interactive" shared desktop heap.
4) The user account does not have permission to run BarTender.]
Seagull.BarTender.Print.Engine.Start(EngineSettings engineSettings) +1077
Seagull.BarTender.Print.Engine.Start() +7
Seagull.BarTender.Print.Engine..ctor(Boolean startEngine) +35
MvcApplication2.Controllers.HomeController.Index() in c:\users\jchan\documents\visual studio 2010\Projects\MvcApplication2\MvcApplication2\Controllers\HomeController.cs:13
lambda_method(Closure , ControllerBase , Object[] ) +62
System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +17
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +205
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27
System.Web.Mvc.Async.<>c__DisplayClass42.<BeginInvokeSynchronousActionMethod>b__41() +28
System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +57
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +50
System.Web.Mvc.Async.<>c__DisplayClass39.<BeginInvokeActionMethodWithFilters>b__33() +58
System.Web.Mvc.Async.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49() +237
System.Web.Mvc.Async.<>c__DisplayClass37.<BeginInvokeActionMethodWithFilters>b__36(IAsyncResult asyncResult) +12
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +57
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +50
System.Web.Mvc.Async.<>c__DisplayClass2a.<BeginInvokeAction>b__20() +24
System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult) +126
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +57
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +45
System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult) +14
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +25
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +61
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +25
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +49
System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10
System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +28
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +25
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +49
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8972365
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184

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

4 コメント

0
Avatar
Ian Cummings
モデレータ
コメントアクション Permalink

Note that the edition of BarTender installed needs to be the Automation edition or higher. If running the Trial then the trial period should not be elapsed.

The following steps show how to add the BarTender .NET SDK into a Visual Studio 2010 project.

1) When VS2010 starts select "New Project" on the start page.

2) Select ".Net Framework 4" and the project's template type and name.

3) In the Solution Explorer right mouse click on the project name and select Properties.

4) On the Application tab change the Target framework to be ".NET Framework 4". The solution will reload.

5) In the "Solution Explorer" right mouse click on the Reference folder and select "Add Reference…"

6) If using BarTender version 9.4 or later, select the ".NET" tab and select the Component Name "Seagull.BarTender.Print".

If using BarTender version 9.3 or earlier, select the "Browse" tab, navigate to the folder "<Program Files>\BarTender Suite\SDK\Assemblies", and select the file Seagull.BarTender.Print.dll

7) In the Solution Explorer edit the file app.config and change the contents to be:

<?xml version="1.0"?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>
The notable change is that "useLegacyV2RuntimeActivationPolicy=true".

8) Add a button to your project's form and write BarTender SDK code as per documentation and samples.

9) Compile and run application.
0
Avatar
Legacy Poster
コメントアクション Permalink

I followed the above and put it undere web.config. I am getting the below error. any idea?

An attempt was made to load a program with an incorrect format.

Assembly Load Trace: The following information can be helpful to determine why the assembly 'BTTemplates' could not be loaded.
 


=== Pre-bind state information ===
LOG: User = IIS APPPOOL\BTWebService AppPool
LOG: DisplayName = BTTemplates
 (Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: BTTemplates | Domain ID: 2
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///C:/inetpub/web_sites/BTWebService/
LOG: Initial PrivatePath = C:\inetpub\web_sites\BTWebService\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\inetpub\web_sites\BTWebService\web.config
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/root/39cf30af/9ae5d663/BTTemplates.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/root/39cf30af/9ae5d663/BTTemplates/BTTemplates.DLL.
LOG: Attempting download of new URL file:///C:/inetpub/web_sites/BTWebService/bin/BTTemplates.DLL.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.
0
Avatar
Domingo Rodriguez
モデレータ
コメントアクション Permalink

Please make sure that the right Edition is in use (if you're developing a web based application which will make use of the .NET Print Server SDK, make sure that you own an Enterprise Automation Edition of BarTender or a Trial Edition with sufficient Trial days left and which is simulating the Enterprise Automation Edition).

 

I'm not quite sure if adding "useLegacyV2RuntimeActivationPolicy="true" to the web.config is required / correct. It is indeed used for app.config, but if you're developing a web based application this might not be required.

 

I suggest instead that you put your web based application into a separate 32 bit application pool, and then try starting the application pool using a different Windows account with sufficient credentials. If this is an account permission issue, starting the application pool under a different Windows account might help. Also, in order to double check that the application pool which is running your web application is a 32 bit pool, please follow the instructions below:

 

  1. Open IIS 7 on the server
  2. Expand the server listing > click on Application Pools
  3. Click on the site’s application pool to select it
  4. In the right hand column, click on Edit Application Pool > Advanced Settings…
  5. In the popup, go to General> Enable 32 bit Applications > change to “True
  6. click ok
  7. In the right hand column, click on Application Pool Tasks > Recycle (or you can stop and start the app pool, if you prefer)

 

 

Did you already try to stop IIS, then open a command prompt dialog in Windows ("Start > Run", then type cmd), browse to the Program Files folder where BarTender Suite is installed, and then run the following command

bartend.exe /register

 

If you still have problems, you might wish to install BarTender Web Print Server as part of BarTender's installation. BarTender Web Print Server (BT-WPS) is our closed web based printing solution. You can test to see if BT-WPS works correctly for you and also take a look at the web.config file it makes use of. The following assembly is added in the web.config file for BT-WPS. I'm not sure if your web based application adds the same assembly:

 

<add assembly="Seagull.BarTender.Print, Version=10.0.4.1, Culture=neutral, PublicKeyToken=109FF779A1B4CBC7" />

 

Hope this helps.

0
Avatar
Ian Cummings
モデレータ
コメントアクション Permalink

Check out BarTender 2016, now supporting x64 and .NET framework 4.0: http://www.seagullscientific.com/downloads/label-software/barcode-label-printing-software-download/

ログインしてコメントを残してください。