viernes, 29 de julio de 2022

Usar una variable en un LIKE sql server

Usar una variable en un LIKE sql server 

Ejemplo:


ALTER PROCEDURE <Name>
(
    @PartialName VARCHAR(50) = NULL
)

SELECT Name 
    FROM <table>
    WHERE Name LIKE '%' + @PartialName + '%'

viernes, 15 de julio de 2022

Unable to read data from the transport connection : An existing connection was forcibly closed by the remote host

 

Unable to read data from the transport connection : An existing connection was forcibly closed by the remote host


Tengo una aplicación de servidor y, a veces, cuando el cliente intenta conectarse, aparece el siguiente error:

Unable to read data from the transport connection : An existing connection was forcibly closed by the remote host

No se pudo obtener la transmisión del cliente o falló el inicio de sesión


Solución:

Después de la versión 4.6 de .NET, también me encontré con este problema.

Asegúrese de revisar su archivo web.config en busca de las siguientes líneas:

<compilation debug="true" targetFramework="4.5">

<httpRuntime targetFramework="4.5" />

Si está ejecutando 4.6.x o una versión superior de .NET en el servidor, asegúrese de ajustar estos valores de targetFramework para que coincidan con la versión del marco en su servidor. Si sus versiones leen menos de 4.6.x, le recomendaría que actualice .NET y use la versión más nueva, a menos que su código dependa de una versión anterior (que, en ese caso, debería considerar actualizarla).

Cambié targetFrameworks a 4.7.2 y el problema desapareció:


<compilation debug="true" targetFramework="4.7.2">

<httpRuntime targetFramework="4.7.2" />

sábado, 9 de julio de 2022

ASP.NET Web Forms: No 'Access-Control-Allow-Origin' header is present on the requested resource

 Es necesario configurar el web config:


<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <httpProtocol>
      <customHeaders>
        <add name="Access-Control-Allow-Origin" value="*" />
        <add name="Access-Control-Allow-Methods" value="GET,POST,OPTIONS" />
        <add name="Access-Control-Allow-Headers" value="Content-Type, soapaction" />
      </customHeaders>
    </httpProtocol>
  </system.webServer>
</configuration>