all.
I created Rest API with ASP.NET 4 and Mongo. It works fine in my local PC under Windows 10, also it works fine in test environment under Windows 2008 R2 + .NET 4.7.1. But it doesn't work on my prod environment under Windows 2012 R2 + .NET 4.7.1, I got the following error:
System.Reflection.AmbiguousMatchException: Multiple custom attributes of the same type found.
at System.Attribute.GetCustomAttribute(Assembly element, Type attributeType, Boolean inherit)
at System.Runtime.InteropServices.RuntimeInformation.get_FrameworkDescription()
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at MongoDB.Driver.Core.Connections.ClientDocumentHelper.CreateClientDocument(String applicationName)
at MongoDB.Driver.Core.Connections.BinaryConnectionFactory..ctor(ConnectionSettings settings, IStreamFactory streamFactory, IEventSubscriber eventSubscriber)
at MongoDB.Driver.Core.Configuration.ClusterBuilder.BuildCluster()
at MongoDB.Driver.ClusterRegistry.CreateCluster(ClusterKey clusterKey)
at MongoDB.Driver.ClusterRegistry.GetOrCreateCluster(ClusterKey clusterKey)
at MongoDB.Driver.MongoClient..ctor(MongoClientSettings settings)
at Treolan.Catalog.Providers.BaseDataProvider..ctor(IAppSettings appSettings) in D:\Projects\TreolanCatalog\Treolan\Treolan.Catalog.Providers\BaseDataProvider.cs:line 39
at Treolan.Catalog.Providers.Categories.CategoriesProvider..ctor(IAppSettings appSettings) in D:\Projects\TreolanCatalog\Treolan\Treolan.Catalog.Providers\Categories\CategoriesProvider.cs:line 22
at Treolan.Catalog.WebApi.Controllers.CategoriesController.<>c.<.ctor>b__6_0() in D:\Projects\TreolanCatalog\Treolan\Treolan.Catalog.WebApi2\Controllers\CategoriesController.cs:line 31
at Treolan.Catalog.WebApi.Controllers.CategoriesController.<Get>d__7.MoveNext() in D:\Projects\TreolanCatalog\Treolan\Treolan.Catalog.WebApi2\Controllers\CategoriesController.cs:line 48
I found the similar issue, but other developers used Application Insight on Azure. I don't use Application Insight or Azure.
I tried to use MongoDb.Driver 2.5.0 and 2.6.1 but I got the same issue.
Could you help me?
I had this issue and after searching I have found a solution for me
My app is in an Azure VM
To solve this
Go to this machine using Terminal Server,
go to Control Panel,
go to programs/features
remove the application insights status monitor toolkit from server
This have resolved the issue for me
Hope it helps
Related
Relatively new to the windows ecosystem. After following the windows documentation on setting up a background application on iot and google's quickstart for C#, I am receiving this error that I cannot seem to solve:
System.IO.IOException: 'Error loading native library "C:\Data\Users\DefaultAccount\AppData\Local\DevelopmentFiles\BackgroundAppFirestoreOne-uwpVS.Debug_ARM.usernoname\grpc_csharp_ext.x86.dll". '
Stack Trace:
System.IO.IOException
HResult=0x80131620
Message=Error loading native library "C:\Data\Users\DefaultAccount\AppData\Local\DevelopmentFiles\BackgroundAppFirestoreOne-uwpVS.Debug_ARM.usernoname\grpc_csharp_ext.x86.dll".
Source=Grpc.Core
StackTrace:
at Grpc.Core.Internal.UnmanagedLibrary..ctor(String[] libraryPathAlternatives)
at Grpc.Core.Internal.NativeExtension.LoadUnmanagedLibrary()
at Grpc.Core.Internal.NativeExtension.LoadNativeMethods()
at Grpc.Core.Internal.NativeExtension..ctor()
at Grpc.Core.Internal.NativeExtension.Get()
at Grpc.Core.GrpcEnvironment.GrpcNativeInit()
at Grpc.Core.GrpcEnvironment..ctor()
at Grpc.Core.GrpcEnvironment.AddRef()
at Grpc.Core.Channel..ctor(String target, ChannelCredentials credentials, IEnumerable`1 options)
at Grpc.Core.Channel..ctor(String host, Int32 port, ChannelCredentials credentials, IEnumerable`1 options)
at Google.Api.Gax.Grpc.ChannelPool.GetChannel(ServiceEndpoint endpoint, IEnumerable`1 channelOptions, ChannelCredentials credentials)
at Google.Api.Gax.Grpc.ChannelPool.GetChannel(ServiceEndpoint endpoint, IEnumerable`1 channelOptions)
at Google.Cloud.Firestore.FirestoreDb.Create(String projectId, FirestoreClient client)
at BackgroundAppFirestoreOne.StartupTask.<Run>d__4.MoveNext() in C:\Users\usernoname\source\repos\BackgroundAppFirestoreOne\StartupTask.cs:line 95
The file is in the directory and does have the necessary permissions.
My environment:
Developing on Windows 10 with Visual Studios 2019 Enterprise
Deploying to a Dragonboard 410c with Windows 10 iot Core
Google.Cloud.Firestore NuGet referenced
I've tried:
Adding the gRPC.core as this suggested, as a NuGet package reference in VS2019, this did not solve the issue.
And I don't have any non-English characters as this suggests.
This error occurs when attempting to execute FirestoreDb db = FirestoreDb.Create(project);
(see line 44 of sample)
Does anyone know what this could be / what I could try to rectify?
I did not encount the exception with Google.Cloud.Firestore 1.1.0 on Windows IoT Core 17763. Could you please check the package version and OS version. BTW, it is not recommended to use the package in background app, since at the moment you can't register a headless app that uses filetypeAssociation, so that the app can not access the credential file(.json).
I would like to create an app that will deploy a website. Basically, I just want this app to copy the publish files to the webserver in a new folder, change the website to that folder, then recycle the app pool.
I found out that I should be able to do this with Microsoft.Web.Administration. I am having a problem with even the most basic task as I'm learning how to do this. here is my code in a windows form app to just play with this.
try
{
using (Microsoft.Web.Administration.ServerManager sm = Microsoft.Web.Administration.ServerManager.OpenRemote("webservername"))
{
foreach (var site in sm.Sites)
{
MessageBox.Show(string.Format("{0}", site.Name));
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
I'm simply trying to loop through the websites and display the names as my first try. The error I get is the following:
System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Web.Administration.Interop.IAppHostWritableAdminManager'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{FA7660F6-7B3F-4237-A8BF-ED0AD0DCBBD9}' failed due to the following error: Interface not registered (Exception from HRESULT: 0x80040155).
at Microsoft.Web.Administration.ConfigurationManager.CreateAdminManager[TClass,TInterface](WebConfigurationMap webConfigMap, Boolean isAdminConfig)
at Microsoft.Web.Administration.ConfigurationManager.CreateWritableAdminManager(WebConfigurationMap webConfigMap, String configPathToEdit, Boolean isAdminConfig)
at Microsoft.Web.Administration.ConfigurationManager.CreateConfiguration(WebConfigurationMap configMap, String configPathToEdit, Boolean isAdminConfig)
at Microsoft.Web.Administration.ConfigurationManager.GetConfiguration(String rawConfigurationPath, String cacheKey, Boolean isAdminConfig)
at Microsoft.Web.Administration.ConfigurationManager.GetApplicationHostConfiguration()
at Microsoft.Web.Administration.ServerManager.GetApplicationHostConfiguration()
at Microsoft.Web.Administration.ServerManager.get_SitesSection()
at Microsoft.Web.Administration.ServerManager.get_Sites()
The line that errored is:
foreach (var site in sm.Sites)
I've tried this with both my local IIS8 express and a windows server 2008 IIS 7.5
What have I done wrong?
You may want to check the following points:
The Name of the server. If not sure try looking for in your IIS Management
The version of the .dll is the right for your version of IIS.
The .net framework version. Since it use System.Web it depends on full-version of the .net framework but not on the Client Profile subset.
The machine on which the code is executing needs to have the IIS Management Scripts and Tools Windows feature installed.
On a Windows client OS or on Windows Server 2008 R2 and earlier, you can install it via the following steps:
Open Control Panel > Programs > Turn Windows features on or off.
Drill down to Internet Information Services > Web Management Tools and check IIS Management Scripts and Tools.
You are trying to manage a remote server, so
The account runs the code must be the local administrator of that remote server.
The DCOM ports must be opened at firewall.
I'm developing an automatic invoicing system using c#.net v4.0 and Sage's SDO. The Application works fine on my local machine both in a development environment and on iis 7. I am now trying to implement it on a live server and I am getting the following error:
SAGE EXCEPTION:Not connected to Data Source - Connect or Logon failed .
Error Code:sdoNotConnected
StackTrace: at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData) at SageDataObject180.IWorkSpace.CreateObject(String Name) at RestrictedPages_ViewReport.GenerateInvoice(Object sender, EventArgs e) in c:\inetpub\wwwroot\IE Support Manager Integration\RestrictedPages\ViewReport.aspx.cs:line 386
The iis7 process is running on a 32 bit process. The folder is hosted on a machine on the network but not on the machine that the web application is installed on. I can read and write to this folder from the web application so I doubt its a permissions problem.
I've been tearing my hair out with this problem for 2 days now so any help would be much appreciated!!
Can you post the actual code where the error is happening? I am guessing its permissions or a variable that needs changing.
Note: This section contains incorrect information - skip to the update below for details. This section left in for historical purposes.
I have a WPF project in Visual Studio 2008 targeting .NET 3.5 that references SharpSVN. When I make a call into SvnClient.Export, I get an exception that Marshal.GetExceptionCode tells me is 0xc06d007e. This seems to be caused by a bad DLL. I have tracked (with the Dependency Walker) that DLL to two culprits: IEFRAME.DLL and SHLWAPI.DLL. They are missing the following export functions:
SHLWAPI.DLL: #270
IEFRAME.DLL: #141, #159, #160
I also initially had a missing DLL that was fixed by adding %ProgramFiles%\Internet Explorer to the path. I do not recall the DLL name.
This is a fresh install of Visual Studio 2008, SharpSVN 1.7002.1998.12257.
I can run the "svn" command that is provided with SharpSVN to export from our repository, so I am leaning toward a solution/project configuration/reference problem.
How do I fix this error?
*Update: I have refined my understanding of this problem. The SHLWAPI and IEFRAME issues appear to be a normal condition - User32.dll has the same behavior. I modified my environment in the following ways:
Environment variable [SVN_SSH] set to TortoisePlink [C:\Program Files\TortoiseSVN\bin\TortoisePlink.exe]
Updated uri target to use current username:
SvnUriTarget uriTarget =
new SvnUriTarget("svn+ssh://" + Environment.UserName + "#myserver/mypath");
With this configuration, I can successfully export when running this code as part of the WPF application. However, I still get errors when running as part of a MSTest project.
System.Runtime.InteropServices.SEHException: External component has thrown an exception.\r\n
at svn_client_export5(Int32* , SByte* , SByte* , svn_opt_revision_t* , svn_opt_revision_t* , Int32 , Int32 , Int32 , svn_depth_t , SByte* , svn_client_ctx_t* , apr_pool_t* )\r\n
at SharpSvn.SvnClient.Export(SvnTarget from, String toPath, SvnExportArgs args, SvnUpdateResult& result) in g:\\dist\\src\\sharpsvn\\commands\\export.cpp:line 100
at SharpSvn.SvnClient.Export(SvnTarget from, String toPath, SvnExportArgs args) in g:\\dist\\src\\sharpsvn\\commands\\export.cpp:line 66
at SimulationManager.Model.SubversionInterface.Export() in C:\\Users\\phines\\Documents\\Projects\\SimulationManager\\SimulationManager\\SimulationManager\\Model\\SubversionInterface.cs:line 43
I suspect this is due to a reliance on the presentation framework, but would still like to know if there is a way to get this working in a GUI-less way.
The errors with IEFrame and SHLWAPI are normal problems that depends reports as errors, but do not acutally cause the error. In my case, the error was caused by using SharpSVN in a non-user interface project. When moved to a WPF project, it worked as expected.
I have changed strategies to call a command shell "svn" application to achieve UI-less automation.
I downloaded the sample LightSwitch app (Online Ordering) and i got an error that i couldnt figure out \ solve.
Error 1 The "SqlInstanceName" parameter is not supported by the "BuildSchema" task. Verify the parameter exists on the task, and it is a settable public instance property. C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v1.0\Microsoft.LightSwitch.targets 160 23 OnlineOrdering
and
Error 2 The "BuildSchema" task could not be initialized with its input parameters. C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v1.0\Microsoft.LightSwitch.targets 157 10 OnlineOrdering
the error is in the following section
<!--The Development Database is built in the same location - Bin\Data - for all configurations.-->
<BuildSchema Inputs="#(LightSwitchModel)"
ProjectPath="$(MSBuildProjectFullPath)"
OutputDirectory="Bin\Data"
SqlInstanceName="$(SqlInstanceName)"
ExternalDataSources="#(ServerExternalDataSources)"/>
Your help is much appreciated!
I wrote that sample. I know it works because I have installed it on a number of machines.
However, LightSwitch was just released today and I have not tested it on the released version of LightSwitch.
What version are you using?