Professional OPC
Development Tools

logos

Online Forums

Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.

Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.

Do not use the Contact page for technical issues.

Programmatically deploy license file

More
04 Dec 2019 07:26 #8069 by support
Hello,

thank you. I do not think that what you have sent are actually screenshots from your computer, it looks apparently like an instruction document to configure DCOM, but I will assume that you have actually performed the steps described there, and it should be OK for now (I am not convinced that setting the Identity on the server to the system account is the right choice, usually a specific user account with proper permissions is used, but we will return to it if needed).

It is my understanding that you have ASP.NET application that runs under IIS. The instructions below assume that. If you are not running your application under ASP.NET in IIS, let me know, because the instructions would not apply. Also note that the instructions may different on different versions of Windows and IIS, but the priniciple should remain the same.

1. Start "Internet Information Services (IIS) Manager". On the computer I used, this is done e.g. from "Server Manager", click "Tools" near upper right corner, and select "Internet Information Services (IIS) Manager".
2. In the tree in the left pane, locate the computer/site/application. Select your application in the tree.
3. In the "Actions" pane on the right hand side, select "Advanced Settings". A dialog titled "Advanced Settings" appears.
4. In the property grid, under "(General)" category, locate the "Application Pool" row, and make note of the value. It might be, for example, "DefaultAppPool", but also something different. Close the dialog by pressing Cancel.
5. In the tree in the left pane of the IIS Manager, select the "Application Pools" node.
6. In the "Application Pools" list in the middle of the window, select the application pool you have noted in Step 4, and press "Advanced Settings" in the Actions pane.
7. In the "Advanced Settings" window, locate and select the "Identity" row under "Process Model" category, Press the small "..." button that appears to the right of the value.
8. In the "Application Pool Identity" window, select "Custom account"., and press the "Set..." button.
9. In the "Set Credentials" dialog, enter User name, Password and Confirm password. For start, use your own user account that you have on that computer. Later on, if things start working, you will need to go back here and think of what the proper account and its permissions should be.
10. Press OK, OK, OK to close the dialogs and accept the changes.
11. Retest your application.

Regards

Please Log in or Create an account to join the conversation.

More
04 Dec 2019 02:50 #8068 by trimurarisingh
im sharing DCOM setting , which i was applied on client server

Could you please share the IIS or IIS Pool Setting document

File Attachment:

File Name: DCOM_Settings.docx
File Size:2,962 KB
Attachments:

Please Log in or Create an account to join the conversation.

More
03 Dec 2019 18:56 #8066 by support
Hello,
this is not something to be resolved from the code or the component - it is a configuration issue.

Please post here the screenshots of how the IIS application pool is configured, and how the DCOM Identity on the OPC Server is configured.

Best regards

Please Log in or Create an account to join the conversation.

More
03 Dec 2019 18:36 #8065 by trimurarisingh
i was reset all dcom setting but getting same error message.
if u r not able to resolve it please let me now because i have no more time to waste here
.

Please Log in or Create an account to join the conversation.

More
03 Dec 2019 11:46 #8063 by trimurarisingh
i was reset the dcon over the server but still getting ***Access is denied. + The client method called was 'ReadMultipleItemValues'. message

please resolved it

Please Log in or Create an account to join the conversation.

More
03 Dec 2019 09:35 #8061 by support
Hello,

I assume you are sending this code in relation to the error "An OPC operation failure with error code -2146959355 (0x80080005) ". If not, let me know.
There are some minor issues with the code (which I will describe further below), but nothing that would be, for itself, the cause for the error. In this sense, the code looks correct to me. What is likely needed to configure the IIS, the DCOM, and the server correctly. That is not a programming task and cannot be done from your code. It has to be done by changing the settings on the system, which I tried to give hints to in my previous post.

The small issues that I see with the code are:
- It is not clear why "new EasyUAClient()" is called at one place, but then "EasyUAClient.SharedInstance" is actually used. The ReadValue call should be done on the instance you have just created (clientUA), OR you should just use the SharedInstance but in that case you do not need to create a new EasyUAClient instance. Mixing the two approaches makes no sense here.
- It is not clear why the same/similar code with "client.ReadItem" appears in two branches - if the same operationw as meant, the logic should be such that the code is not repeated.
But none of this is critical.

Regards

Please Log in or Create an account to join the conversation.

More
03 Dec 2019 08:31 - 03 Dec 2019 09:27 #8059 by trimurarisingh
here is my code
public string  GetPLCValue(string TagName)
        {
            string strReturn = "0";
            try
            {
                OPCServerName = ConfigurationManager.AppSettings["OPCServerName"].ToString();
                int PLCMode = ML_Common.string2int(ConfigurationManager.AppSettings["PLCMode"].ToString());
                if (!string.IsNullOrEmpty(OPCServerName) && !string.IsNullOrEmpty(TagName))
                {
                    OPCServerName = OPCServerName.Trim();
                    //LicenseInfo.RegisterManagedResource();
                    var client = new EasyDAClient();
                    try
                    {
                        //object value = client.ReadItemValue("", OPCServerName, TagName);
                        //strReturn = (value == null) ? "" : value.ToString();
 
                        Logger.WriteLog("OPCServerName:" + OPCServerName + "  " + TagName);
 
                        object value = string.Empty;
                        if (PLCMode == 1)
                        {
                            DAVtq vtq = client.ReadItem("", OPCServerName, TagName);
                            if (vtq.HasValue)
                            {
                                strReturn = (vtq.Value == null) ? "" : vtq.Value.ToString();
                            }
                        }
                        else if (PLCMode == 2)
                        {
                            string UAendpoint = ConfigurationManager.AppSettings["UAendpoint"].ToString();
                            if (!string.IsNullOrEmpty(UAendpoint))
                            {
 
 
                                try
                                {
                                    // Instantiate the client object
                                    var clientUA = new EasyUAClient();
 
                                    UAEndpointDescriptor endpointDescriptor = UAendpoint;
 
                                    // Obtain attribute data. By default, the Value attribute of a node will be read.
                                    UAAttributeData attributeData;
 
                                    value = EasyUAClient.SharedInstance.ReadValue(endpointDescriptor, "nsu=http://test.org/UA/Data/;i=10853");
 
                                    //value = clientUA.ReadValue(endpointDescriptor, "nsu=http://test.org/UA/Data/;i=10853", UAAttributeId.DataType);
 
                                    strReturn = value.ToString();
 
                                    //attributeData = clientUA.Read(endpointDescriptor, "nsu=http://test.org/UA/Data/;i=10853");
 
                                    //if (attributeData.HasValue)
                                    //{
                                    //    strReturn = attributeData.Value.ToString();
                                    //}
                                    //else
                                    //{
                                    //    strReturn = "0";
                                    //}
                                }
                                catch (UAException uaException)
                                {                                   
                                    strReturn = "0";
                                    lblMsg.Text = "***Failure: " + uaException.GetBaseException().Message;
                                    Logger.Log(uaException);
                                    Logger.WriteLog("Failure: OPCServerName:" + OPCServerName + "  " + TagName + "  " + uaException.GetBaseException().Message.ToString());
 
                                }
 
                                //// Display results
                                //Console.WriteLine("Value: {0}", attributeData.Value);
                                //Console.WriteLine("ServerTimestamp: {0}", attributeData.ServerTimestamp);
                                //Console.WriteLine("SourceTimestamp: {0}", attributeData.SourceTimestamp);
                                //Console.WriteLine("StatusCode: {0}", attributeData.StatusCode);
                            }
                            else
                            {
                                strReturn = "0";
                            }
 
                        }
 
                        else
                        {
                            value = client.ReadItemValue("", OPCServerName, TagName);
                            strReturn = (value == null) ? "" : value.ToString();
                        }      
                    }
                    catch (OpcException ex)
                    {
                        strReturn = "0";
                        lblMsg.Text = "***" + ex.GetBaseException().Message;
                        Logger.Log(ex);
                        Logger.WriteLog("OPCServerName:" + OPCServerName + "  " + TagName + "  " + ex.Message.ToString());
                    }
                }
 
            }
            catch(Exception ex)
            {
                Logger.Log(ex);
                lblMsg.Text = ex.Message.ToString();
                strReturn = "0";
            }
 
            return strReturn;
        }
Last edit: 03 Dec 2019 09:27 by support. Reason: formatting

Please Log in or Create an account to join the conversation.

More
03 Dec 2019 08:14 #8058 by support
Dear Sir,

"Please share the asp.net code for PLC single read tag value on Rockwell PLC": We do not provide code for specific OPC servers. OPC is a universal interface and there are hundreds, if not thousands OPC server models.

An example in ASP.NET (connecting to our simulation server) is included with the product. Load the C# examples solution, it is there under Web\WebApplication1. The code-behind looks like this:

using OpcLabs.EasyOpc.DataAccess;
using System;
 
namespace WebApplication1
{
    // ReSharper disable InconsistentNaming
    public partial class _Default : System.Web.UI.Page
    // ReSharper restore InconsistentNaming
    {
        // ReSharper disable InconsistentNaming
        protected void Page_Load(object sender, EventArgs e)
        // ReSharper restore InconsistentNaming
        {
            var client = new EasyDAClient();
            object value = client.ReadItemValue("", "OPCLabs.KitServer.2", "Demo.Single");
            TextBox1.Text = (value == null) ? "" : value.ToString();
        }
    }
}
Regards

Please Log in or Create an account to join the conversation.

More
03 Dec 2019 08:09 #8057 by support
Dear Sir,

our last communication on this forum topic, my message from 22 Nov 2019 20:11, was about the error "Attempt to add existing key into a dictionary." related to the licensing. I have asked you some questions, such as whether the method is not being executed multiple times, but you have provided no answer. I cannot provide support without your cooperation, so for me the issue about the the error "Attempt to add existing key into a dictionary." is closed for lack of cooperation from your side.

I will now respond to the issue with error "An OPC operation failure with error code -2146959355 (0x80080005) ", although that is clearly a separate issue, and you have been instructed to create a new, separate forum topic for such issues. Create separate forums topics in the future for separate issues.

The error 0x80080005 corresponds to "Server execution failed ". It does not come directly from QuickOPC. It comes from the underlying COM/DCOM infrastructure, and QuickOPC just passes it over to you. As you have indicated that you are running your code from IIS, this is most likely related related to COM/DCOM (security) configuration. One of the reasons I have seen in the past is that the server process starts under a user account that does not have sufficient permissions, and/or it fails to register its "class factory" with the system in time.

By default, IIS is set up in such a way that anything that runs in its context is severely restricted. This is good for security, but prevents some usual COM/DCOM operations from working. You need to tweak the system settings. This involves, in general, settings for followings things:
- The user account of the worker process or app pool in IIS under which your application runs.
- Settings in DCOMCFNG for OpcEnum.
- Settings in DCOMCNFG for particular OPC Server you are connecting to. Specifically, which user account it is configured to run under. This is done when right-clicking on the server object in DCOMCFG, select properties, switch to the Identity tab. It should not be "Interactive user". It needs to be either the "Launching user" (if you know what the launching user will be, otherwise you get problems), or, AT BEST, set it to "This user" and specify a user account name/password with sufficient permissions to run the server.

Please check the process list (e.g. in Task Manager) for what happens when your project starts. How many instances of OPC server process are there? None (bad), a single one (good), or two or more? (also bad). Under which user account does it run? Is it the one you want? If it is launched under the default account for the IIS app pool (which is very restricted), it is bad - and need to be reconfigured in DCOMCNFG.

If the connections to the OPC Server work the "normal" OPC clients (with desktop user interface), try (just for experiments) setting the identity of the app pool in IIS to the "normal" user account, to see if that helps. If it does, you know you need to work with accounts/permissions.

If the server is remote, DCOM settings get complicated even more. See www.opclabs.com/resources/technology-opc/opc-videos/opc-dcom .

Regards

Please Log in or Create an account to join the conversation.

More
03 Dec 2019 02:19 #8056 by trimurarisingh
Could Please share the asp.net code for PLC single read tag value on Rockwell PLC
Please share working code only

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.064 seconds