Connecting to NetServer; "IServiceProvider is not registered with NetServer"
I am trying to create a session for the NetServer version 10.2.1 the program will read the connecting from SuperOffie in order to test for trusted connection, but I get an error saying: "IServiceProvider is not registered with NetServer"
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ePath + ".config");
string ConnectionString = SuperOffice.Configuration.ConfigFile.Data.Database.ConnectionString;
What does that mean?
Alle Svar (6)
BTW: The configuration file:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="SuperOffice">
<sectionGroup name="Factory">
<section name="CustomFactories" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<section name="DynamicLoad" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</sectionGroup>
<sectionGroup name="Security">
<section name="Cryptography" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<section name="Sentry" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</sectionGroup>
<sectionGroup name="FeatureToggles">
<section name="State" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</sectionGroup>
<sectionGroup name="Data">
<section name="Session" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<section name="Database" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<section name="ImplicitAnonymous" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<section name="Explicit" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</sectionGroup>
<section name="Threading" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<section name="Diagnostics" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<section name="Globalization" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<section name="Services" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<section name="Documents" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="bin" />
<dependentAssembly>
<assemblyIdentity name="System.Text.Encoding.CodePages" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="NodaTime" publicKeyToken="4226afe0d9b296d1" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.3.0" newVersion="3.0.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="BouncyCastle.Crypto" publicKeyToken="0e99375e54769942" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.8.9.0" newVersion="1.8.9.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="MimeKit" publicKeyToken="bede1c8a46c66814" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.10.0.0" newVersion="2.10.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="HtmlSanitizer" publicKeyToken="61c49a1a9e79cc28" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="AngleSharp" publicKeyToken="e83494dcdc6d31ea" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-0.14.0.0" newVersion="0.14.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="HtmlAgilityPack" publicKeyToken="bd319b19eaf3b43a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.11.27.0" newVersion="1.11.27.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.IdentityModel.Tokens" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.8.0.0" newVersion="6.8.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.IdentityModel.Logging" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.6.0.0" newVersion="5.6.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IdentityModel.Tokens.Jwt" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.8.0.0" newVersion="6.8.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="MailKit" publicKeyToken="4e064fe7c44a8f1b" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.10.0.0" newVersion="2.10.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<SuperOffice>
<Data>
<Session>
<!-- HttpContext means that session information is stored in the Http context, instead of being recreated all the time -->
<add key="Mode" value="Process" />
<add key="ReauthenticateOnDeserialization" value="false" />
</Session>
<Database>
<add key="DatabaseMajor" value="MSSQL" />
<add key="DatabaseMinor" value="15" />
<add key="Server" value="localhost" />
<add key="Database" value="SUO10.2.1" />
<add key="CommandTimeOut" value="300" />
<add key="TablePrefix" value="CRM10" />
<add key="ConnectionString" value="Server=[@Server];Database=[@Database];Trusted_Connection=True" />
</Database>
<ImplicitAnonymous>
<add key="Allowed" value="False" />
<add key="DBUser" value="" />
<add key="DBPassword" value="" />
<add key="CommonDBConnection" value="True" />
<add key="SoUser" value="" />
<add key="SoPassword" value="" />
</ImplicitAnonymous>
<Explicit>
<add key="ExternalPersonAllowed" value="False" />
<add key="EmployeeAllowed" value="True" />
<add key="SystemAllowed" value="True" />
<add key="DBUser" value="" />
<add key="DBPassword" value="" />
<add key="CommonDBConnection" value="True" />
</Explicit>
</Data>
<Documents>
<!-- Location of SO_ARC -->
<add key="ArchivePath" value="c:\so_arc" />
<!-- Location of template folder.
This folder only needs to be specified when it is other than default. -->
<!--<add key="TemplatePath" value="\\\\qa-build\\StateZeroSoArc\\Template" />-->
<!-- Location of temporary folder for streaming files.
This path must resolve to the same location for farms/culsters. -->
<add key="TemporaryPath" value="c:\\temp" />
<!-- Impersonate user when accessing the document archive or the temporary folder -->
<add key="ImpersonateUser" value="False" />
<!-- Name of the user to impersonate with -->
<add key="ArchiveUser" value="" />
<!-- Password of the user to impersonate with -->
<add key="ArchivePassword" value="" />
<!-- Domain of the user to impersonate with -->
<add key="ArchiveDomain" value="" />
<!-- Size of internal buffer in KB -->
<add key="BufferSize" value="1024" />
</Documents>
</SuperOffice>
</configuration>
Hi Martin,
Have you seen this before?
Hi Tony!
Thank you I got it to compile, but it had more small errors that I don't think I got right.
Do you have a revision 2 of the project, there was references to SoCore-project and other SuperOffice projects, they were easy to fix, but also the AddNetServerCore() has changed I think, so I tried this:
var services = new ServiceCollection();
services
.AddNetServerCore<ProcessContextProvider>()
.AddSoDatabase()
.AddSingleton<ILogger, SuperOffice.Logging.SoLogger>()
.AddSingleton<IContextInitializer, ContextInitializer>();
var provider = services.BuildServiceProvider(true);
provider.RegisterWithNetServer();
using var soSession = SuperOffice.SoSession.Authenticate("MA", "ma");
var ce = Contact.GetFromIdxContactId(2);
But I am not sure it is correct. Also the app.config had a lot of sections that was not in the config-section, I just deleted them.
I ended with a "Object not set to a reference" on the Authenticate() no other help there.
So I am not sure what goes down for me.
Regards Martin
Hi Martin,
did you figure out how to get rid of the "IServiceProvider is not registered with NetServer" error? I'm having the same issue with one of our appstore-applications, but the two alternatives from the GitHub examples doesn't fix the error.