IIS - Native error 28037 - Asked By LILLEB on 01-Sep-14 10:43 AM

I'm trying to to realise a merge replication with SQL Server 2008 R2 to SQL Server compact.
I have created a distributor (system database), a publication and a subscription sucessfully with SQL Server Wizrds.

But I fail when i try to create a subscription with a .net code (c#). I always get the same error message which is follows :
"the request to send data to the computer running IIS has failed. for moreinformation, see Hresult". I have consulted many forums but in vain.

NB : I'am using Visual Studio 2008
this is my code :

using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
using System.Data.SqlServerCe;
using System.IO;


namespace replicationTest
{
    public partial class Form1 : Form
    {
    private const string _dbName = "technomadMob.sdf";

    public Form1()
    {
      InitializeComponent();
    }

    private void buttonSynchro_Click(object sender, EventArgs e)
    {
      
      SqlCeReplication repl = new SqlCeReplication();

      repl.InternetUrl = "http://localhost/iishelp/web/sqlcesa35.dll";
      repl.InternetLogin = "genicom";
      repl.InternetPassword = "lyas";
      repl.Publisher = @"GENICOM-370E0D9";
      repl.PublisherDatabase = "TECHNOMADE";
      repl.PublisherSecurityMode = SecurityType.NTAuthentication;
      repl.Publication = "PubRef";
      repl.Subscriber = "JDU";
      repl.HostName = "JDU";

      repl.SubscriberConnectionString = @"Data Source=" + _dbName
     + ";Max Database Size=128;Default Lock Escalation =100;";
      
      try
      {
      
      if (!System.IO.File.Exists(_dbName))
      {       
        repl.AddSubscription(AddOption.CreateDatabase);
      }         
      repl.Synchronize();    // the problem is here refering to tests i've done
      }
      catch (SqlCeException ex)
      {
      MessageBox.Show(ex.ToString());     
      }

      finally
      {
      if (repl != null)
        repl.Dispose();
      }     
    }
    }
}

when i run the code the database "technomadMob.sdf" is created but i ignore where exactly (I know this by tests). So everytime I run the code I change the name of the database.

Pleeeeeeeeeeeeease Help.
Best regards
Mihir Soni replied to LILLEB on 01-Sep-14 10:43 AM
This Error means that HTTP request is failed. It can occur due to various reasons. To find the root cause please try following
 
On a browser on client type http://server_IP_address/virtual directory alias/sscesa30.dll.
 
If you can’t access this, it meant that connection from device to IIS is broken.
If you can access this, it meant that there is issue in getting connected /access permission etc from IIS to SQL Server/Publication.
 
1. Check - SQL Server agent is running.  
2. Windows firewall is not  blocking Web Services. For IIS 5.1, follow these steps:
          In control panel-> windows firewall -> Advanced -> Settings -> Services , check the Web Server(HTTP) option.
          Norton or other tool can prevent snapshot access to client. Check the settings. Try turning off the firewall.
3. Ensure that ASP.NET is registered with IIS. To do this, go to the Windows\Microsoft.Net\Framework\<version directory> in the system drive and execute <aspnet_regiis.exe -i> on the command line.
 
 
Give IUSer_ServerName a permission on publication. As you are not getting this error all the time, it does not seem a permissions issue. It seems a connectivity issue.
 
As this works fine for 4 month and then you installed June CTP. Try recreating the virtual directory , publication and subscription.
 
If it does not resolve the issue – please provide details.
 
            1. Are you using SQL Server, IIS on same machine or on different.
            2. What authentication mechanism you are using on IIS/SQL machine?
            3. When you get error at that time can you access http://server_IP_address/virtual directory alias/sscesa30.dll.
            4. When you get error, verify the connectivity between client and server (is it working)
LILLEB replied to Mihir Soni on 08-Mar-11 07:01 AM
Thanks a lot for your respense Mr Mihir Soni in spite it didn't work.
before providing details you sollicit, I would like to give you somme details I have omit.
  -I'm not using a device for the replication (not yet). i'm working with an emulator provided with visual studio 2008
  -I'm using SQL Server, IIS on same machine
  -the replication succed when i use the SQL Server wizard to create a subscription. Then i have copied the same parametres to my .net replication without success
  -I'm not using ASP for the replication.

I have follow your solution step by step, these are the results :
  -the access to the URL "http://localhost/iishelp/web/sscesa30.dll" fails, but the access to "http://localhost/iishelp/web/sqlcesa35.dll" succed, I can see in the result page the following message "Microsoft SQL Server Compact Server Agent"
  -I Have verified the SQL Server agent, It is running (it is set to automatic)
  -for the Web Server(HTTP) option, I've already tryed it but in vain
  -I've desabled my Antivirus and fire-wall
  -the command <aspnet_regiis.exe -i> fails in the directory Windows\Microsoft.Net\Framework\v3.5

These are details you ask for :
1- I'm using SQL Server, IIS on same machine
2- I use windows authentification (SecurityType.NTAuthentication;)
3- the access to the URL "http://localhost/iishelp/web/sscesa30.dll" fails, but the access to "http://localhost/iishelp/web/sqlcesa35.dll" succed, I can see in the result page the following message "Microsoft SQL Server Compact Server Agent"
4- the client and server are on the same machine, so I think that the connectivity is not a problem.

NB : I don't understand why you have said : "As this works fine for 4 month and then you installed June CTP".
NB : I hope that I gave you the clarification you want about my problem.

Best Regards Mr Mihir Soni