Hello Community,

 

When calling a custom web service that uses anonymous authentication from the browser using this link : 

"http://mycreatio.com/0/ServiceModel/UsrCustomConfigurationService.svc/G…"

 

The page does not seem to work.

 

Note :  we have an on premise Creatio instance on Linux based on .Net Core.

 

Bellow are the steps to reproduce the case:

 

The Academy guides on how to Create a custom web service that uses anonymous authentication for .NET Core : https://academy.creatio.com/docs/developer/back_end_development/web_ser…

This is the class indicated in the first step (that returns the contact ID by the contact name) : 

namespace Terrasoft.Configuration.KycCustomConfigurationService {

    using System;

    using System.ServiceModel;

    using System.ServiceModel.Web;

    using System.ServiceModel.Activation;

    using Terrasoft.Core;

    using Terrasoft.Web.Common;

    using Terrasoft.Core.Entities;

    using Terrasoft.Web.Http.Abstractions;

    [ServiceContract]

    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]

    public class KycCustomConfigurationService: BaseService {

        private SystemUserConnection _systemUserConnection;

        private SystemUserConnection SystemUserConnection {

            get {

                return _systemUserConnection ?? (_systemUserConnection = (SystemUserConnection) AppConnection.SystemUserConnection);

            }

        }

        /* The method that returns the contact ID by the contact name. */

        [OperationContract]

        [WebInvoke(Method = "GET", RequestFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped,

            ResponseFormat = WebMessageFormat.Json)]

        public string GetContactIdByName(string Name) {

            SessionHelper.SpecifyWebOperationIdentity(HttpContextAccessor.GetInstance(), SystemUserConnection.CurrentUser);

            var result = "";

            var esq = new EntitySchemaQuery(SystemUserConnection.EntitySchemaManager, "Contact");

            var colId = esq.AddColumn("Id");

            var colName = esq.AddColumn("Name");

            var esqFilter = esq.CreateFilterWithParameters(FilterComparisonType.Equal, "Name", Name);

            esq.Filters.Add(esqFilter);

            var entities = esq.GetEntityCollection(SystemUserConnection);

            if (entities.Count > 0) {

                result = entities[0].GetColumnValue(colId.Name).ToString();

                result = entities[0].GetTypedColumnValue(colId.Name); */

            }

            return result;

        }

    }

}

and this is the changes to the ..\Terrasoft.WebHost\appsettings.json file

"Terrasoft.Configuration.KycCustomConfigurationService": [

                                "/ServiceModel/KycCustomConfigurationService.svc"

                        ]



Thank you,

 

Like 0

Like

1 comments

Hello,
Based on the coe alone it is almost impossible to say what is the cause of the issue.
What kind of error you are facing, why do you think that the page isn't working?
Make sure that you created a class in the ..\Terrasoft.WebApp\ServiceModel for your service and check if you modified a services.config files as well as the Web.config.

Show all comments

Hello team, 

While compiling i get the following error

2023-02-28 00:25:54,747 [75] ERROR IIS APPPOOL\test_site Build BuildInternal - An error occured while running dotnet cli

System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified

   at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)

   at Terrasoft.Core.Compilation.ProjectBuilder.BuildInternal(String projectFilePath, String tempPath, BuildCommandParameters parameters).

 

I have already tried the suggestion in this thread : https://community.creatio.com/questions/buildcompile-error

and still keep getting the same error

Sasori

Like 0

Like

3 comments

Sasori Oshigaki



Can you please share the complete error captured in log file?

Hi Bhoobalan Palanivelu,

The one mentioned is the complete error in the BuildLog file

Regards

Make sure the IIS AppPool user has full write access to CreatioWebroot\Terrasoft.WebApp\Configuration

Ryan

Show all comments

I am trying to setup the WorkspaceConsole for .Net core application(CRM bundle v8.0) and trying to follow the link https://academy.creatio.com/docs/8-0/developer/development_tools/delive… on Ubuntu.

Can anyone please assist on Step 4 replacement for .Net core as we cannot find the mentioned file

 

Like 0

Like

3 comments

Hello Altaf,



There is a separate paragraph in this article for WorkspaceConsole on .NET Core



Best regards,

Bogdan

 

Thanks Bogdan. I missed it.

Would like to know whether BuildConfiguration is equal to BuildWorkspace from .Net framework? As I checked my changes were not built after running BuildConfiguration only. It works only when we trigger Publish from Creatio.

Altaf Hussian,



You can find the description of the Parameter in the same article. 



Best regards,

Bodagn

Show all comments

Hi Support. Installing linux .NET Code over Docker linux is working perfect. 

I have a issue when the settings fileDesignMode=true and UseStaticFileContent=false the site is not loging anymore. Even after generate all schema code and compile all.

 

Any ideas if Im missing something?

Like 0

Like

4 comments

Hello Federico,



Please try to open the configuration section  (https://yourwebsitename/0/dev) and compile the website. 



Please contact our support team (support@creatio.com) If it didn't solve the issue.



Best regards,

Bogdan

Hi Bogdan

 I did many times and test diferente approach and still same error. I guess I will contact support 

Hi Federico,

In which file you have changed the fileDesignMode? Is that web.config?

In net core is terasoft.web.host.dll.config the equivalent to web.config

Show all comments

Hello,

 

We have a use case where we send information from a website to creatio via custom code. Landing page was not suited for our usecase.

 

We successfully implemented this using Anonymous Service which has code to manage CORS. We need to make the service work for .net core now. How do we transfer below code to .net core setup since the name 'WebOperationContext' does not exist in .net Core? What is the best practice to overcome CORS error in .net core setup?

 

// Preflight
 
[OperationContract]
        [WebInvoke(Method = "OPTIONS", UriTemplate = "*")]
        public void GetCaptchaPreflight() {
            var outgoingResponseHeaders = WebOperationContext.Current.OutgoingResponse.Headers;
            outgoingResponseHeaders.Add("Access-Control-Allow-Origin", "*");
            outgoingResponseHeaders.Add("Access-Control-Allow-Methods", "GET, POST, OPTIONS");
            outgoingResponseHeaders.Add("Access-Control-Allow-Headers", "*");
            outgoingResponseHeaders.Add("Access-Control-Request-Headers", "X-Requested-With, x-request-source, accept, content-type");
        }
    }
 
// Request endpoint
[OperationContract]
        [WebInvoke(Method = "POST", RequestFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped,
        ResponseFormat = WebMessageFormat.Json)]
 
        public void ConfirmCaptcha(Stream responseDetails)
        {
		 var logger = global::Common.Logging.LogManager.GetLogger("CaptchaService");
		 logger.Info("Captcha services entered :");
			var currentWebOperationContext = WebOperationContext.Current;
			var outgoingResponseHeaders = currentWebOperationContext.OutgoingResponse.Headers;
            outgoingResponseHeaders.Add("Access-Control-Allow-Origin", "*");
			outgoingResponseHeaders.Add("Access-Control-Allow-Methods", "POST");
			outgoingResponseHeaders.Add("Access-Control-Allow-Headers", "Origin, Content-Type, Accept");
 
			try
            {
 
            StreamReader reader = new StreamReader(responseDetails);
            string responseJson = reader.ReadToEnd();
            logger.Info("Captcha services :" + responseJson);
 
              ResponseDetails rd = new ResponseDetails();
                rd = JsonConvert.DeserializeObject<ResponseDetails>(responseJson);
                if (!string.IsNullOrEmpty(rd.GToken))
                {
                    if (IsCaptchaVerified(rd.GToken))
                    {
                        logger.Info("Captcha is valid");
						logger.Info(rd.LeadId);
						logger.Info(rd.ContactId);
						logger.Info(rd.LeadResponse);
 
					}
                }
                else
                {
                    logger.Info("Captcha is invalid");
                }
            }
Like 0

Like

1 comments

Hello,

 

As for now we don't have best practices for CORS management for .NET Core however you need to try testing all the recommendations described here (they are for .NET Core).

 

Best regards,

Oscar

Show all comments