User:anonymousLog inRegister
Recents:
Web Model - .NET Generator Manual of GeneXus X

Web Model

SQL server connection error during build

seems that there is no way to resolve that -- try anything suggest by sqlserver and google-ing the problem

Copyright (C) Microsoft Corporation. All rights reserved.

"C:\Models\Knowledge Base Invoice\CSharpModel\web\bin\reor.exe" -nogui -noverifydatabaseschema


Internal error: Function call failed (A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server))
Internal error: Function call failed (A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server))
The reorganization process was not successfully completed.
Reorganization Failed

 

can GENEXUS provide us with the solution to the above

Model Configuration

        1.        Create an enviroment by going into the Preferences tab located in the Knowledge base navigator, right click above  Kb name, " New Environment". (By default, GeneXus creates an environment depending on the information given when creating the knowlegde base. )

  §         Language = .NET
§         User Interface = Web

2.        Setup model properties:   Preferences/ .NET Environment

§         Target Path
  §         User Interface
  §         Language: C#
        §         Datasource: SQL SERVER | DB2 | ORACLE | POSTGRESQL | DB2 FOR ISERIES | MYSQL | INFORMIX
  §         Startup Object: None (by default)

3.        Setup DBMS options:

         §      Access technology to set: ADO.NET | JDBC | RUBY | iSeries Native

   §      Database name: <Database name> 
 
  §      Server name: <server name or IP>

   §      Server TCP/IP Port:,<Port>
   §      Use trusted connection: No 
   §  User id: <usuario>
  
§  User password: <password>  

4.          Setup execution properties: Preferences / .NetEnvironment / Generator

    §        Compiler flags
 §        Compiler directory
    §       Reorganize server tables

  1.   Run database creation (if the database does not exists, it will be created)

§  Build / Create Database 

  1. Generate, specify and compile programs:
         
          §  Build / Build All / Rebuild All - in the "Build" Tab

        7.    In the "Build" tab of genexus you can choose either to run the startup object (by default developer menu) or any object with the property "main program" as True. 

On compiling Webxxx, Webxxx.dll (IL code) assembly is generated under the bin directory and an entry may be added in web.config or not (depending on the property HttpHandlerFactory )

 The compilation output is sent to the Runout.log file. 

         Hwebxxx.aspx is called in runtime. 

Notes:

  • In case you setup trusted connection (step 3) you must setup ASP.NET rights 
  • In case you use ODBC access, you must setup the Access technology in the DBMS Options to set: ODBC (Step 3) and Model Property Access Method in ODBC as well. If you want to get connected through a data source ODBC, it must belong to the system.
  • After compiling, GeneXus will create a virtual directory with the name specified in the local IIS, pointing at the < KB physical directory >\<target Path>\web.
  • In case you execute from a directory of the internal network, you must take into account the settings of Rights .NET and Web server rights to execute an application for steps 5 and 7. 

.NET Generator Properties

Web Server

Indicates the Web Server that will be used at runtime.   

Values

- Internet Information Server
- ASP.NET Development Web Server //WebDev
- WebDev.WebServer2

 
Default Value = It depends on the Web Server installed. If IIS or ASP.NET are installed, they are the default value, respectively. Otherwise, if no Web Server is installed, the default value is WEDdev.webserver2, which is installed with GeneXus.  

  Generation 

 After having specified an object, when generating it, the generator creates the following for each object: 
                              -       A file with the source code in C# language (.cs),
                              -       A file with the same name as the object and with '.rsp' extension. This file contains the information required to compile it (sources included, references, etc.). 
                              -    If it is main, it also creates a bld<object name>.cs file that executes the assembly of the object and the related ones (called from it). The other main objects are not included within the related ones, since they are ssembled compiling them specifically.  
                              -    If a reference is made to SDTs, collections or Business Components, a type_<nombre_del_sdt>.cs file is created with the definition of the structured type referenced.  
                              -    The gxcommon.rsp file is also created. Its objective is assembling an assembly (with the same name) that includes the objects common to all the assemblies (SDTs, collections). 

Compilation

The code is compiled when build selected and a dll is generated with the common .NET code (IL). This is supervised, in runtime, by an interpreter (CLR) that allows executing it, converting it into a PC code. 
The log with the compilation result is displayed on the screen and stored in the  RunOut.log file.
The Web.config file or the header object (dependiendig the config httphandler section property ) contains the information on the web application configuration. There, each dll is associated to a virtual page with ASPX extension. There is no physical aspx file. The Web.config are sorted by priority in ascending order in the directory tree. 
Only with the Ashx value of this property a physical file is generated for each object. 
The WebConfig file is generated from GXCFG.Web, which has an entrance for each object and is the UpdateConfigWeb that enters the information to the Web.Config after the compilation is finished.  
Like the other generators, .Net is supported by a set of standard programs. These programs have StrongName which means that they are identifiable, with a unique name in the .NET universe. Generated programs also have the possibility of setting up a strong name (but reorganization assemblies don’t). This is useful to do automatic deployment in Global Assembly Cache (GAC) 

Advanced

trace generation

To enable application trace generation (log file), you must setup the Log level model property. This property adds two settings in web.config file after the compilation. 

    1. Enables the trace setting up with the “threshold” tag

             <log4net threshold="<Value>">

    2. Enables the log file

           <system.web>
               <trace enabled="true" /> 

With step 1 if <Value> is different from OFF,  log messages are generated, but they are sent to the ASP.NET trace and accessing the log file is not possible. Step 2 is setup with this objective.   

By default the Web models have ASPNetTraceAppender as “root appender”, this means that it does not generate a file as logging file, but that it sends logging messages to the ASP.NET trace. Therefore, the above mentioned settings must exist for generating the file.
After generating a logging file from Web applications, you may see it by accessing the following URL: http://servername/dirvirtual/Trace.axd 

When a remote Web application is run, it is necessary to include the localOnly ="false" option in order to visualize the trace from client PCS.
Otherwise, the trace will only be visualized from the server itself. For visualizing the trace from client PCs, the following input must be introduced:
 <system.web>
    <trace localOnly="false" enabled="true" /> 

Notes:
- Logging file generation may degrade application performance; this is why we recommend having it switched off in production.
- For <log4net threshold="OFF">, the logging file is not generated, and none of the below mentioned settings (trace and root) are taken into consideration. In this case, logging messages are simply not generated from xClasses.dll.
- From web application it is posible generate a log file
- For more information about log4net, go to the following URL: http://log4net.sourceforge.net/ 

Configuration files

When we are working with .NET applications, we have configuration files where certain application properties are defined, such as the information for the connection to the database or the settings of a “log” file.

web.config

It is created when web applications are generated and is used when we run applications under Internet Information Server. 
It has the settings about the location of the applications server, the connection to the database and the generation of the “log”, among other.  
It is located under the “csharp” model directory and its structure is similar to the following:   

<configuration>
  <appSettings>
    <add key="AppMainNamespace" value="GeneXus.Programs" />
    <add key="DataStore1" value="Default" />
    <add key="DataStore-Count" value="1" />
    <add key="Connection-Default-DBMS" value="sqlserver" />
                     ….
  </appSettings>

<log4net threshold="OFF">
         <appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
         <file value="client.log" />

            ....
     
          </layout>
          </appender>
          <appender name="ASPNetTraceAppender" type="log4net.Appender.ASPNetTraceAppender">
          ......

           </layout>
           </appender>
           <appender name="EventLogAppender" type="log4net.Appender.EventLogAppender">
                .....

           </layout>
           </appender>
           <root>
                   <level value="DEBUG" />
                   <appender-ref ref="RollingFile" />
           </root>
  </log4net>
 
<system.web>
       <trace enabled="false" />
       <httpHandlers>
                <add verb="*" path="*.aspx" type="GeneXus.HttpHandlerFactory.HandlerFactory,gxclasses" />
       </httpHandlers>
  </system.web>
</configuration>
 

The System Web section is not rewritten by the generator. The Appsetting section is written by the generator after each compilation (model properties and generator settings are stored there).Note: This web.config is also used in distributed applications when the applications Server runs under IIS. For further information please refer to Distributed applications

DataBase connection

The information of the connection to the database remains stored in the web.config file with the following format:  
  <appSettings>
    <add key="Connection-Default-DataSource" value="mydatasource" />
    <add key="Connection-Default-User" value="Elj20MqY44RPdvT8FEpDD0==" />
 
     

 These tags are not framework proprietors; they are defined by the generator. In some casers, their content do require a standard format defined by the platform. E.g.: the database connection string in ADO.NET models with SqlServer may be:   

<add key="Connection-Default-Opts" value=";Integrated Security =No; Max Pool Size = 50; Min Pool Size=10" />

Identity impersonate

This allows web objects to run with the user that IIS transfers to the .net platform. Otherwise, the processes run with the “machine” account (ASP.NET user).
It is specified within the System.Web section with the following tag  

<identity impersonate="true" />

Considerations:

        -          It is necessary if you want to use trusted connection for the connection to the database (Sql Server); otherwise, it executes with ASPNET user.
-          PDF Reports: When having identity impersonate="true", the user executing in the page IIS must have written rights over "C:\Documents and Settings\<webserver name>\<ASPNET\Local Settings\Temp" with IIS 5 or higher version. With IIS 6.0 or higher version (Windows 2003) rights must be granted over the directory C:\Windows\Temp\...\iTextdotNET. (but it is configurable) .
Otherwise, the following error occurs:  Access to the path "C:\DOCUME~1\ARMIN-NB\ASPNET\LOCALS~1\Temp\e8ebd99f-17de-4447-83f8-35769f67bd23\iTextdotNET” 

SessionState  

To implement sessions management (Websession data type) the generator uses the HttpSessionState provided by the framework. 
There are three ways to store the session state:

         1 – Inproc, which uses aspnet_wp.exe.
         2 - Stateserver used when there is more than one server.  
        3 – Sqlserver, which uses SQL Server tables instead of the web Server memory to store the information saved in the sessions.    

1-Inproc is the default mechanism implemented by the generator. When aspnet is recycled,   session variables get lost. 
2-StateServer  the websession can be stored within the memory space of a process called aspnet_state.exe. 
This is useful in prototyping to maintain the websession, since after recycling aspnet_wp or compiling the objects and upload them again, the Websession gets lost.
To implement it, you must first upload the ASP.NET State Service (aspnet_state.exe) service in the PC that will maintain the session. Then, you must add the following line in web.config:

  <system.web>
        <sessionState 
            mode="StateServer" 
            stateConnectionString="tcpip=name_pc:42424" />
             ....
            
....
  </system.web> 

The stateConnectionString attribute contains the IP and port of the PC used to maintain the session The default port is 42424.
3-Sqlserver, for this you should:

3.a – The <Framewrok_Path>\aspnet_regsql.exe (or InstallSqlState.sql) must be execute in order to SQLServer session support

3.b - change web.config with the connection string  
   <system.web> 
        <sessionState mode="SQLServer" 
                      sqlConnectionString=" Integrated Security=SSPI;data source=dataserver;"  

For example in order to store the session in Sql server table, without Integrated security: 

3a - <Framework_Path>\aspnet_regsql.exe -S  SERVERNAME  -U  USER  -P  PASSWORD  -ssadd -sstype p 

the ASPState Database would be created 

3b-  Modify Web.config file

<sessionState allowCustomSqlDatabase="true" mode="SQLServer" stateNetworkTimeout="20" sqlConnectionString="Data Source=SERVERNAME;Initial Catalog=ASPState;Integrated Security=False;User ID=USER;Password=PASSWORD" cookieless="false" timeout="20" />

Besides, you can setup the time the session variables last. By default they expire; websession variables lost their value with a 20-minute timeout.  

This timeout can be setup from
        <sessionState mode="InProc"
                      cookieless="false"
                      timeout="20"/> 

For more information, please refer to:  http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconsessionstate.asp
In w2003 Server, you can setup the timeout by virtual directory. For this, in the virtual directory properties, you must setup the value from:  Virtualdirectory\Configuration\options\Enabled Session State

Http Execution Timeout

 There is a way of setting up the requests timeout in .Net applications (both in Web applications and in 3-tier applications hosted in the IIS).   
 In Web applications, if a page request takes more than 90 seconds, a Request Timeout message will be sent to the browser.   
To avoid timeouts, you must create the following in the System.Web session of the web.config file: 

<httpRuntime  executionTimeout="<secs>"/> 

Where <secs> is the number of seconds you want to wait; e.g.: 3600. 

For more information, please refer to the HttpRuntime section:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/gngrfhttpruntimesection.asp 

 

Http MaxRequest Length

 There is a way of determine the maximum value of upload file size 

              <httpRuntime  maxRequestLength="<size>"/> 

Where <size> is the number of bytes; e.g.: 20120. 

Generate log file – Rolling file

It is possible to setup a Web model so that it will also generate a text file by adding the following inputs in the web.config file:

1.<appender  name="RollingFile" type="log4net.Appender.RollingFileAppender">
 
            <file  value="C:/<directorio del modelo>/web/log/client.log"/>
            <appendToFile  value="true"/>
            <maximumFileSize  value="9000KB"/>
            <maxSizeRollBackups  value="4"/>
            <layout  type="log4net.Layout.PatternLayout">
                        <conversionPattern  value="%d{HH:mm:ss,fff} %t %-5p                  %c{1} %x - %m%n"/>
            </layout>
</appender>

 

Please note that slashes “/” must be used for specifying an application directory.

 

    2. The <appender-ref  ref="RollingFile"/> input must also be included.

Input inside Tag root, for instance:
<root>
                <level  value="DEBUG"/>
                <appender-ref  ref="RollingFile"/>
                <appender-ref ref="ASPNetTraceAppender" />
</root> 

It is important to differentiate “appenders” that are working as “root”, because these appenders are going to be considered by log4net when printing logging messages. It will send log messages to all appenders inside the “root” tag. 

In the previous case, since the "RollingFile" and “ASPNetTraceAppender" values are not setup, the client.log file will be generated in the web/logging directory, below the model directory and access to the trace will also be possible through the following URL: http://servername/dirvirtual/Trace.axd 

In this case, there is only a single appender:    
  <root>
                <level value="DEBUG" />
                <appender-ref ref="ASPNetTraceAppender" />
  </root> 

Therefore, the client.log file will not be generated. There will only be access to the trace through the following URL: http://servername/dirvirtual/Trace.axd
If in a Web application web.config file the following is setup:

  <log4net threshold="ALL"> 

and in the Tag root:
  <root>
                <level value="DEBUG" />
                <appender-ref ref=" RollingFile" />
  </root>

the following settings will not be taken into consideration:

  <trace enabled="true" /> 
  <trace localOnly="false" enabled="false" />

because these settings are only valid for the following appender:

   <appender-ref ref="ASPNetTraceAppender" /> 

For information about Deploy , please refer here

 

Created: 11/17/08 10:19 AM by docampo Last update: 12/19/12 01:54 PM by jlarrosa
 
Page
Share
Categories
Group
Powered by GXwiki 4.0 Beta1 (generated with GeneXus X Evolution 2)