IIS cannot locate the Enterprise Architect Addin - iis-6

I have a Web Application written in C# that uses allows the user to create diagrams and export them to Enterprise Architect. The plugin is also written in C# and built with the option Register for COM Interop. When I debug the application using Visual Studio 2015, it works without problem, but when I try to deploy it using IIS, it doesn't work.
I tried to register manually the MyAddin.dll using
c:\windows\...\4.0.30319\regasm c:\inetpub\wwwroot\myApp\bin\MyAddin.dll /codebase
and then added it to the registry, using the key
HKLM\Software\Wow6432Node\Sparx Systems\EAAddins\MyAddin
but I still get an error.
The Error is the following:
"Error while executing transaction. Actions have been rolled back."
Exception"System.Runtime.InteropServices.COMException (0x80080005): Die COM-Klassenfactory für die Komponente mit CLSID
{67F4E0FA-46A7-4255-B084-69A9433D08C3}
konnte aufgrund des folgenden Fehlers nicht abgerufen werden: 80080005 Server execution failed (Ausnahme von HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)).
bei System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
bei System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
bei System.Activator.CreateInstance(Type type, Boolean nonPublic)
bei System.Activator.CreateInstance(Type type)
bei NAF.Util.EaUtil.load_ea_repository(String eapFilePath)
bei EABridge.CapabilityImporter.Import(Int32 projectId, String eaTemplatePath)
bei EAsyNAF.WebApp.Controllers.HomeController.<>c_DisplayClass15_0.<CreateProject>b_0(ITransaction transaction)
bei EAsyNAF.WebApp.Utils.TransactionUtils.ExecuteTransaction(Action`1 action, IDataServiceManager dataService, ILogger logger, Action customRollback)"
I'm using Windows 7 Enterprise and IIS 6.1 SP1
Does someone have an idea what that could be?

EA needs a logged in user to use the API. When you run it in IIS you access EA as service. That simply does not work.
I vaguely remember some project (was it on SourceForge?) which a couple of years has been started to deal with that. But that is stalled.
The guys at LieberLieber have something in that direction: https://www.lieberlieber.com/en/web-collaborator-for-enterprise-architect/
See also http://www.sparxsystems.com/forums/smf/index.php/topic,30960.msg224599.html#msg224599

We managed to get it running, by using a tool called FireDaemon. We have read that there is an issue with the so called "Session 0". This app allows us to run as service in this session. I tried other tools, like http://nssm.cc/, but it didn't work in our case. We created a WCF service for the EA Add-in and this service is now started via FireDaemon.
We are still trying to find another solution, but at least we got our application running.

Related

Calling Web API from SQL Server when API is configured to use Windows Authentication

I have an internal web site that is secured with Windows Authentication. This works correctly.
Contained in the site I have several methods accessible via Web API.
The intent is to automate the calling of those API methods from a SQL 2008 SSIS job. This is our preferred process so that all scheduled tasks are in one place.
When I call the Web API from the desktop of a user that is in the appropriate AD security group the Web API call works properly but when I try to call the API from the SSIS job I get an access error. I have tried putting valid credentials in the SSIS job but that didn't work, I still get the same error.
What security context is this job running under? Can I add that security context to the AD group and get everything working?
Web API under a different authentication process? Can this be configured in web.Config or on the page itself?
**** Update
I've confirmed that the account I expected is the account that is doing the call.
I have more details on the exact error message being returned:
SSIS package "XXManagerAdd.dtsx" starting.
Error: 0x1 at Trigger API: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Net.WebException: The remote server returned an error: (401) Unauthorized.
at System.Net.WebClient.OpenRead(Uri address)
at ST_4b03489e84c44950b38aac6439e328ee.csproj.ScriptMain.Main()
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTATaskScriptingEngine.ExecuteScript()
Task failed: Trigger API
SSIS package "XXManagerAdd.dtsx" finished: Success.

Method not found: 'Void System.Web.UI.ScriptResourceDefinition

I've built a fairly simple website in using Visual Studio 2012 using .net 4.5 version.
When I uploaded the website to my server I get the following error:
Method not found: 'Void System.Web.UI.ScriptResourceDefinition.set_LoadSuccessExpression(System.String)'.
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.MissingMethodException: Method not found: 'Void System.Web.UI.ScriptResourceDefinition.set_LoadSuccessExpression(System.String)'.
[MissingMethodException: Method not found: 'Void System.Web.UI.ScriptResourceDefinition.set_LoadSuccessExpression(System.String)'.]
Microsoft.ScriptManager.WebFormsv45.PreApplicationStartCode.Start() +0
[InvalidOperationException: The pre-application start initialization method Start on type Microsoft.ScriptManager.WebFormsv45.PreApplicationStartCode threw an exception with the following error message: Method not found: 'Void System.Web.UI.ScriptResourceDefinition.set_LoadSuccessExpression(System.String)'..]
System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +423
System.Web.Compilation.BuildManager.CallPreStartInitMethods() +306
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +677
[HttpException (0x80004005): The pre-application start initialization method Start on type Microsoft.ScriptManager.WebFormsv45.PreApplicationStartCode threw an exception with the following error message: Method not found: 'Void System.Web.UI.ScriptResourceDefinition.set_LoadSuccessExpression(System.String)'..]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9090876
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +97
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +256
(the hosting company provides the following: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272)
I am aware of this question/answer:
http://forums.asp.net/t/1823969.aspx/1 But I find it wasn't very helpful since it doesn't provide any details about where I would correct the references (I am not sure where/what csproj is).
Also I am aware of the similar question posted here with no answers:
Method not found: 'Void System.Web.UI.ScriptResourceDefinition.set_LoadSuccessExpression(System.String)'
Any tips and suggestions how to fix this issue are appreciated.
Thank you!
The LoadSuccessExpression property is a new property in .NET 4.5. Since your host only supports .NET 4, this property does not exist when deployed.
You're getting a missing method exception since a property setter is really just a method behind the scenes.

The underlying connection was closed: The connection was closed unexpectedly

I am using Visual Studio 2010 & SQL Server 2008 R2. I have created a project to sync SQL Server CE (*.sdf) file to SQL Server using a WCF service.
It is working fine when I have small SQL Server CE file (18 MB) but when I tried to sync using a large SQL Server CE file (38 MB) then an error happens.
I have increased size of many parameters in web.config of the WCF service & app.config of my application.
But the error keeps occurring.....
The underlying connection was closed: The connection was closed
unexpectedly.
StackTrace :
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at Microsoft.Synchronization.Data.ServerSyncProviderProxy.GetChanges(SyncGroupMetadata groupMetadata, SyncSession syncSession)
at Microsoft.Synchronization.SyncAgent.DownloadChanges(SyncGroupMetadata groupMetadata)
at Microsoft.Synchronization.SyncAgent.DataSynchronize()
at Microsoft.Synchronization.SyncAgent.Synchronize()
at SyncSample.AccountsListing.btnSync_Click(Object sender, EventArgs e)
Above exception means that there's something unexpected happened due to which connection is closed, and most of the time it's due to some exception on service side which caused to reject the request. You can enable WCF tracing for the service and check the logs to confirm the exception. Most of the time, exception message suggests you what went wrong ;-)
HTH,
Amit
I was recently getting errors like this from a web service when I had not configured it correctly to handle enough data eg: maxBufferPoolSize, maxReceivedMessageSize and the like.
Also if you are sending a large array the service behaviour and endpoint behavior sections of these files may need:
<dataContractSerializer maxItemsInObjectGraph="array size here"/>
as Amit suggested, you should try enabling WCF Tracing. the error you are getting can mean many things happening on the server side.
unless you're building a Windows Mobile app, I suggest you use the newer SqlSyncProvider/SqlCeSyncProvider/SyncOrchestrator combo as well instead of the older SqlCeClientSyncProvider/DBServerSyncProvider/SyncAgent (the same one used by Local Database Cache Project Item)
the newer providers has functionalities around batching if data size is really your problem.

WCF DTO transfer problem "Cannot convert from XX to XX"

I'm having the following problem:
cannot convert from 'MyProject.DataLayerServiceRef.MyDTO'
to 'WCFService.MyDTO'
when i'm trying to call a method from the service to add an object to the database.
The problem is that my servicereference method is given a MyProject.DataLayerServiceRef.MyDTO TYPE while the service method wants a WCFService.MyDTO TYPE
What am I doing wrong here..? I'm new to WCF and simply cannot see what I have done wrong
What I'm trying to achieve is to create a new object client-side and use my wcf service to save it to the database (I have created a EDMX file in the service).
EDIT
now I get a new error..:
System.ServiceModel.FaultException:
The server was unable to process the
request due to an internal error. For
more information about the error,
either turn on
IncludeExceptionDetailInFaults (either
from ServiceBehaviorAttribute or from
the configuration
behavior) on the server in order to
send the exception information back to
the client, or turn on tracing as per
the Microsoft .NET Framework 3.0 SDK
documentation and inspect the server
trace logs. Server stack trace: at
System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message
reply, MessageFault fault, String
action, MessageVersion version,
FaultConverter faultConverter) at
System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime
operation, ProxyRpc& rpc) at
System.ServiceModel.Channels.ServiceChannel.Call(String
action, Boolean oneway,
ProxyOperationRuntime operation,
Object[] ins, Object[] outs, TimeSpan
timeout) at
System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage
methodCall, ProxyOperationRuntime
operation) at
System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage
message) Exception rethrown at [0]: at
System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
reqMsg, IMessage retMsg) at
System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgData, Int32 type) at
IDataLayerService.GetAnsatList() at
DataLayerServiceClient.GetAnsatList()
in
H:\Projekt\DataLayerServiceRef.cs:line
233 at
Projekt.Controllers.HomeController.Index()
in
H:\Projekt\Controllers\HomeController.cs:line
27
I've tried setting the "includeExceptionDetailInFaults", but that doesnt seem to help.. :(
The error occurs in this line of the homecontroller.cs:
AnsatDTO[] list = dls.GetAnsatList();
dls is my proxy and the GetAnsatList() method is a service method
Problem solved by creating a new WCF service from scratch.. :)

WCF - Custom Credentials & Security Tokens

I'm fairly new to WCF development and have run into a couple problems whilst learning the framework. I have a service api which must support both REST & SOAP. So far this has been easy to implement especially with WCF4 and routing.
I am currently working on authorization and have managed to extend AuthorizationManager by creating two new manager classes: "ApiKeyAuthorizationManager" & "ApiKeyAndTokenAuthorizationManager"
Most of my services will require an ApiKey and Token (GUIDS) to be present; when initially authenticating, you simply need a valid ApiKey and password to receive a Token.
So far REST is working perfectly as the Authorization managers look to the query string to get ApiKey and/or Token.
So for example a service uri would look like:
*http://api.domain.com/Service/Operation/{someVariableValue}?ApiKey=GUID&Token=GUID
My problem now comes with authorizing SOAP service calls. I've done a little bit of research and have come to a few conclusions I wanted to verify are correct before implementing.
In order to authorize SOAP with custom credentials I should:
Create custom service token (MSDN)
Extend WCF by creating a custom SecurityTokenProvider, SecurityTokenAuthenticator, and SecurityTokenSerializer (MSDN)
Extend WCF by creating custom AuthorizationPolicies (MSDN)
Am I on the right track for this? Are all these steps needed to fit my scenario? Seems like so much customization for just verifying a credential made up of two GUIDs.
Thanks!
[EDIT #1]
This has been a very difficult task. Custom credentials and security tokens is nearly undocumented. Finding quality blog posts itself has proven near impossible. I've kept plugging away and am so close to have a working solution. I've even hit the same road blocks as described in this post.
When I try to access my service to uncover the wsdl or mex I receive this error:
The service encountered an error.
An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
System.InvalidOperationException: An exception was thrown in a call to a policy export extension.
Extension: System.ServiceModel.Channels.SymmetricSecurityBindingElement
Error: Specified argument was out of the range of valid values.
Parameter name: parameters ----> System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: parameters
at System.ServiceModel.Security.WSSecurityPolicy.CreateTokenAssertion(MetadataExporter exporter, SecurityTokenParameters parameters, Boolean isOptional)
at System.ServiceModel.Security.WSSecurityPolicy.CreateWsspSignedSupportingTokensAssertion(MetadataExporter exporter, Collection`1 signed, Collection`1 signedEncrypted, Collection`1 optionalSigned, Collection`1 optionalSignedEncrypted)
at System.ServiceModel.Security.WSSecurityPolicy.CreateWsspSupportingTokensAssertion(MetadataExporter exporter, Collection`1 signed, Collection`1 signedEncrypted, Collection`1 endorsing, Collection`1 signedEndorsing, Collection`1 optionalSigned, Collection`1 optionalSignedEncrypted, Collection`1 optionalEndorsing, Collection`1 optionalSignedEndorsing, AddressingVersion addressingVersion)
at System.ServiceModel.Security.WSSecurityPolicy.CreateWsspSupportingTokensAssertion(MetadataExporter exporter, Collection`1 signed, Collection`1 signedEncrypted, Collection`1 endorsing, Collection`1 signedEndorsing, Collection`1 optionalSigned, Collection`1 optionalSignedEncrypted, Collection`1 optionalEndorsing, Collection`1 optionalSignedEndorsing)
at System.ServiceModel.Channels.SecurityBindingElement.ExportSymmetricSecurityBindingElement(SymmetricSecurityBindingElement binding, MetadataExporter exporter, PolicyConversionContext policyContext)
at System.ServiceModel.Channels.SecurityBindingElement.ExportPolicy(MetadataExporter exporter, PolicyConversionContext context)
at System.ServiceModel.Description.MetadataExporter.ExportPolicy(ServiceEndpoint endpoint)
--- End of inner ExceptionDetail stack trace ---
at System.ServiceModel.Description.ServiceMetadataBehavior.MetadataExtensionInitializer.GenerateMetadata()
at System.ServiceModel.Description.ServiceMetadataExtension.EnsureInitialized()
at System.ServiceModel.Description.ServiceMetadataExtension.HttpGetImpl.InitializationData.InitializeFrom(ServiceMetadataExtension extension)
at System.ServiceModel.Description.ServiceMetadataExtension.HttpGetImpl.GetInitData()
at System.ServiceModel.Description.ServiceMetadataExtension.HttpGetImpl.TryHandleDocumentationRequest(Message httpGetRequest, String[] queries, Message& replyMessage)
at System.ServiceModel.Description.ServiceMetadataExtension.HttpGetImpl.ProcessHttpRequest(Message httpGetRequest)
at SyncInvokeGet(Object , Object[] , Object[] )
at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)
If you have any idea what might be causing this I'd love some help.
[EDIT #2]
It seems Microsoft doesn't want to update their samples to show how to allow wsdl support for custom credentials / tokens. See here.
Anyone have an idea how to get this working? What's the point of making a framework extensible if there's no documentation how to extend it?!?
[EDIT #3]
As stated in my comment below...
I have TransportWithMessageCredential working just fine using UserNameSecurityToken. Unfortunately, my services will end up requiring custom tokens when it's time to implement some more advanced features that I have planned.
What I'm looking for as an answer would be:
How to support custom service credentials and tokens with WSDL support?
Currently, following Microsoft's examples, you can only use custom credentials by using ChannelFactory and creating a custom binding on the client. I would rather not deal with that.
If this question remains unanswered, I'll keep upping the bounty. As soon as I can get this all working I'll write up a blog tutorial on all the steps required to creating a custom security solution.
I would advise you look to Windows Identity Foundation, and move in the direction of claim based security/federation. This model supports custom credentials much better as they are just a different set of claims.