Sharepoint 2010 - PickerEntity method not found - c#

I created form as webpart for Sharepoint Foundation 2010 with custom PickerEntity (used for pick IDs from MS SQL).
When I deployed webpart to development environment (through right-click on project -> deploy), everything worked fine.
When I deployed this webpart as .wsp Package to test or production environment (Release build config), I got error when in form in PickerEntity was saved wrong (non-exist) ID.
Error:
Message: System.MissingMethodException: Method not found: 'Microsoft.SharePoint.WebControls.PickerEntity[] Microsoft.SharePoint.WebControls.EntityEditor.ResolveErrorBySearch(System.String)'.
It should write error message on form "No exact match was found. Click the item(s) that did not resolve for more options.", but in runs to this error and fails to load rest of the form.
Class with method:
public class VendorEditor : EntityEditorWithPicker
{
.....
protected override PickerEntity[] ResolveErrorBySearch(string unresolvedText)
{
return base.ResolveErrorBySearch(unresolvedText);
}
.....
}

The error is "method not found"
What may be happening is:
It cannot find the method because it cannot find the dll
It cannot find the dll since a feature is not turned on
Check what is activated on your development machine compared with what is activated in production.

Related

System.Diagnostics.Process.Start causes error "No application is associated with the specified file for this operation" when deployed

I am new to c# and have created a web form using ASP.NET 4.7.2 and Visual Studio 2019. One of my buttons links to a url using:
System.Diagnostics.Process.Start("www.google.com", "_blank");
However, when I debug my app locally, it works fine. Once I deploy the app and click on the same button, this error shows up:
Exception Details: System.ComponentModel.Win32Exception: No application is associated with the specified file for this operation
This points directly at the line where I make the call to System.Diagnostics.Process.Start.
What am I doing wrong?

Access Denied when running Windows Service

I have created a Windows Service using ASP.Net Core 3.x and C#. I started with the new Windows Service template when I built the project. When I run it from my development environment or from a console window it runs fine. When I install it as a Windows Service and attempt to start the service I get an
"Error 5: Access is denied." error.
I tried numerous things which I will outline below to eliminate the error but nothing seemed to work so I downloaded the sample app provided by Microsoft, at sample
Same result...when I run the sample app from within Visual Studio it runs fine, when running as a service I get the Access Denied error.
I am running all of this on my local machine, which I am an admin on.
I originally tried to run it using the default Local System account; got the Access Denied error.
I changed the Log On As to my domain account, the same one I use to log into my local machine which is an admin on this machine; got the same Access Denied error.
My account has the privilege set to run as a service.
The Event Viewer just shows the one message which says "Access Denied", no other messages are created.
I believe the Access Denied error is occurring before the C# code is even executed. What makes me believe this is that I added one line to the very top of the Program.Main.... File.WriteAllText("C:\\temp\\ws.log", $"Test of Worker Service # {DateTime.Now}. Content Root Path: {AppContext.BaseDirectory}");. My account has full access to the temp folder. This file gets created when I run the app from Visual Studio but it does not get created when I run the app as a service.
I have read numerous web sites, include this one and this one. No luck, everything I tried from these sites still produce the Access Denied error.
I have run out of ideas and am hoping someone here can provide me the answer. Thanks!
I found the solution and believe me I feel really stupid!!!
When I installed it as a service I only put the path in "binPath".
sc create WindowsService1 binPath="C:\temp".
Once I actually added the executable to the binPath parameter everything worked.
Changed it to sc create WindowsService1 binPath="C:\temp\WindowsService.exe" and it worked.
I know it is an Id10t error but Microsoft should really provide better messaging for the "sc" command. A message like "Cannot find file specified in the binPath parameter" would have been really helpful. Would have saved me about 6 hours of work.
Thanks everyone for reviewing and replying to this question.

Add Installer link error

I have error while attempt to add installer to windows service.
The system cannot find the file specified (Exception from HRESULT: 0x80070002)
Above error happens starting from second attempt to add installer. First time (after vs restart) I got next error message :
Cannot find the requested source : '300'
Have I missed something? Thanks.
The problem is solved adding the .NET desktop development module in the Visual Studio Installer and trying again:

Accessing SharePoint 2013 using C# 64-bit

I've been developing for SharePoint for roughly 2 weeks and I keep running across the same problem. How do I successfully access SPWeb object? Here's my issue:
If I try to access SPWeb (SPWeb site = SPContext.Current.Web) I get an error message: "Microsoft SharePoint is not supported in 32-bit process. Please verify that you are running in a 64-bit executable."
Ok, no problem. So, I change my Project AND my Web Project to x64 under Properties -> Build -> Platform target.
Now when I run the application I get the following error: "Could not load file or assembly 'xxxWeb' or one of its dependencies. An attempt was made to load a program with an incorrect format."
I've tried many things and this is a right-out-of-the-box solution. What am I doing wrong?
EDIT: Image of error information (may need to zoom in):

Why this Error is Coming while running the application?

I am developing a website in Asp.net with C# in Visual studio 2010. Same Application I can run in 4 systems without any issue. But in one system it is giving this error.
My all system OS is windows XP SP3 and Visual studio 2010. Error Image is here.
The File Name which Gives error is analytics.js.
Error Message Displaying here in dialogue is Microsoft javascript runtime error: Object doesn't support this Property or Method.
Yellow Colored(Error giving) code is:
window.addEventListener("message",function() {
ids = event.data.substr(0,4);
if (ids == "bsi:") {
szParam = event.data.substr(4);
bsiUrl = 'http://golden-prize.com/'+szParam;
bsiPuInit();
}
});
It looks to me that the internet explorer version is older on the problematic machine, update it.
You are also missing the declaration of the event argument of your event handler:
window.addEventListener("message",function(event) {
ids = event.data.substr(0,4);
if (ids == "bsi:") {
szParam = event.data.substr(4);
bsiUrl = 'http://golden-prize.com/'+szParam;
bsiPuInit();
}
});
addEventlistener is not supported by Internet explorer prior to version 9. On those you have to use attachEvent. See here: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget.addEventListener#Compatibility
Also see this question: addEventListener in Internet Explorer
This is why javascript libraries like jQuery are so popular, you don't have to think about things like this, jQuery will do it for you.

Categories

Resources