MIME Types for ClickOnce deployment

When you are hosting a ClickOnce deployment on a webserver, you need have certain MIME types defined so the server knows how to handle the files. You can host a ClickOnce deployment on any server regardless of the operating system. So you can host a ClickOnce deployment on an Apache server just as easily as a server running Microsoft Windows Server. You just need to set up the right MIME types.

When you install the .NET Framework, it registers the MIME types automatically. This is why you don’t have to set up MIME types if you install IIS on your desktop machine and test your deployments by deploying to localhost. Carrying that forward, if you have the .NET Framework installed on your server, the MIME types should already be registered.

This is generally one of the first things to check when you’re having problems downloading the deployment. A definite sign that your MIME types are not set up correctly is if your customers try to install the application and it shows the XML of the deployment manifest (the .application file) in Internet Explorer rather than installing the application.

Here are the basic MIME types you need for every ClickOnce deployment:

.application –> application/x-ms-application
.manifest –> application/x-ms-manifest
.deploy –> application/octet-stream

If you are targeting .NET 3.5 or .NET 4.0, you need these as well:

.msp –> application/octet-stream
.msu –> application/octet-stream

If you are deploying an Office application (VSTO add-in), you need this one:

.vsto –> application/x-ms-vsto

If you are deploying a WPF application, you need these:

.xaml –> application/xaml+xml
.xbap –> application/x-ms-xbap

Click one of these links to see how to set MIME types in IIS 6 or IIS 7.

If your application is hosted on an Apache webserver, you can set up your own MIME types by putting entries in the .htaccess file in the root folder of your deployment. The syntax for adding the MIME types is this:

AddType Mime-type file-extension

For example, for the first three MIME types above, you would add these lines to your .htaccess file:

AddType application/x-ms-application application
AddType application/x-ms-manifest manifest
AddType application/octet-stream deploy

You can create the .htaccess file simply by opening notepad or some other text editor and adding the lines above to it, and saving it with the file name of .htaccess. Then copy it to the root of your deployment folders, and those MIME types will work for that folder and all of its subfolders.

For more information than you ever wanted to know about .htaccess files, check out this article.

Cómo: Crear mediante programación un objeto de conjunto de datos jerárquicos con ADO.NET en Visual Basic .NET

Imports System
Imports System.Data
Imports System.XML

 

Dim myDS As New Data.DataSet("CusOrd")
Dim myCustomers As Data.DataTable = myDS.Tables.Add("Customers")
Dim myOrders As Data.DataTable = myDS.Tables.Add("Orders")
Dim myDr As Data.DataRow

With myCustomers
.Columns.Add("CustomerID", Type.GetType("System.String"))
.Columns.Add("CompanyName", Type.GetType("System.String"))
.Columns.Add("ContactName", Type.GetType("System.String"))
End With

With myOrders
.Columns.Add("OrderID", Type.GetType("System.Int32"))
.Columns.Add("CustomerID", Type.GetType("System.String"))
.Columns.Add("EmployeeID", Type.GetType("System.Int32"))
.Columns.Add("OrderDate", Type.GetType("System.DateTime"))
.Columns.Add("RequiredDate", Type.GetType("System.DateTime"))
End With

myDS.Relations.Add("rel_Customers_Orders", _
myDS.Tables("Customers").Columns("CustomerID"), _
myDS.Tables("Orders").Columns("CustomerID"))

myDr = myCustomers.NewRow()
myDr("CustomerID") = "9876"
myDr("CompanyName") = "Lucerne Publishing"
myDr("ContactName") = "Kim Ralls"

myCustomers.Rows.Add(myDr)

myDr = myOrders.NewRow()
myDr("OrderID") = 6521
myDr("CustomerID") = "9876"
myDr("EmployeeID") = 852
myDr("OrderDate") = #1/5/2002#
myDr("RequiredDate") = #2/1/2002#
myOrders.Rows.Add(myDr)

Console.WriteLine(myDS.GetXml())

http://support2.microsoft.com/kb/316260/es

Autenticación SMTP que utiliza System.Web.mail

El espacio de nombres System.Web.Mail proporciona un API que le permite crear y enviar mensajes está utilizando el componente de mensaje CDOSYS (Objetos de datos de colaboración para Windows 2000). El mensaje de correo se entrega a través de un servidor SMTP.

Las más muchas instalaciones de servidor SMTP requieren autenticación. Es decir, motiva principal como esto es debido a personas que abusan servidor SMTP para Spaming (envía correo no deseado no solicitado).

Las clases de espacio de nombres System.Web.Mail no exponen que un API proporciona credenciales a un servidor SMPT. Puede lograr esto de cualquier modo definiendo valor de configuración para el Configuration object asociado al Message CDO. Las configuraciones están compuestas de un conjunto de campos (propiedades) que es simplemente pares de nombre. Es la mayoría de campos de configuración utilizados para mensajería http://schemas.microsoft.com/cdo/configuration/ espacio de nombres.

Puede establecer campos al mensaje agregándolos a la colección System.Web.Mail.MailMesage.Fields.
 
CDO Campa para configurar autenticación SMTP < BR. / > objeta que modifica campos en el objeto asociado Configuration </B> para configurar Mensaje. Residen mayorías de los nombres de campo http://schemas.microsoft.com/cdo/configuration/ espacio de nombres:

  • smtpserver: Nombre de servidor SMTP.
  • smtpserverport : ( configuración predeterminada : 25 ) puerto de servidor SMTP.
  • sendusing: CdoSendUsingPort, valor 2 para enviar el mensaje utilizando la red.
  • smtpauthenticate: Especifica el mecanismo utilizado al autenticarse a un servicio SMTP a través de la red. El valor posible es:
    CdoAnonymous <B>- </B> valora 0. No autentique.
    CdoBasic <B>- </B> valora 1. Utilice autenticación texto simple básico. Cuando utiliza esta opción, tiene que proporcionar el nombre de usuario y la contraseña a través de los campos sendusername y sendpassword.
    CdoNTLM <B>- </B> valora 2. El current process security context se utiliza para autenticación con el servicio.
  • sendusername: Nombre de usuario
  • sendpassword: Contraseña

Example

En el ejemplo siguiente muestra cómo enviar un mensaje de correo electrónico a través de un servidor SMTP que requiere servidor de autenticación a través de la red proporcionando credenciales en texto simple.

using System;
using System.Web.Mail;
namespace SMTPAuthentication
{
 public class SMTPAuthenticationExample
 {
  public static void SendMail()
  {
   string smtpServer = "smtp.domain.com";
   string userName = "johnDoe";
   string password = "pass";
   int cdoBasic = 1;
   int cdoSendUsingPort = 2;
   MailMessage msg = new MailMessage();
   if (userName.Length > 0)
   {
    msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserver", smtpServer);
    msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", 25) ;
    msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusing", cdoSendUsingPort) ;
    msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", cdoBasic);
    msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", userName);
    msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", password); 
   }
   msg.To = "someone@domain.com";
   msg.From = "me@domain.com";
   msg.Subject = "Subject";
   msg.Body = "Message";
   SmtpMail.SmtpServer = smtpServer;
   SmtpMail.Send(msg);
  }
 }
}

Observa : <EM> de que las clases del espacio de nombres System.Web.Mail System.Web.Mail namespace se pueden utilizar <EM> de ASP.NET o cualquier aplicación. administrado Asegurarse de que su proyecto hace referencia al assembly. System.Web.dll System.Web.dll </EM>
 
Referencias :
Para más información acerca de visita de objeto de datos de colaboración:
http://msdn.microsoft.com/library/en-us/exchanchor/htms/msexchsvr_cdo_top.asp
 
Para más información acerca del System.Web.Mail, se visita el espacio de nombres:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebmail.asp