Home Page
Articoli
Tips & Tricks
News
Forum
Archivio Forum
Blogs
Sondaggi
Rss
Video
Utenti
Chi Siamo
Contattaci
Username:
Password:
Login
Registrati ora!
Recupera Password
Home Page
Stanze Forum
.NET Framework
DLL COM in VB.NET da utilizzare in ASP
venerdì 16 marzo 2007 - 12.20
Elenco Threads
Stanze Forum
Aggiungi ai Preferiti
Cerca nel forum
pons
Profilo
| Newbie
5
messaggi | Data Invio:
ven 16 mar 2007 - 12:20
Ciao,
ho fatto una DLL con VB.NET e vorrei utilizzarla in un'applicazione web fatta in ASP.
La DLL contiene una cosa tipo questa:
------------------------------
Imports ...
Public Class libConnessioni
Public Function LDAPgetAllEmails(ByVal domain As String) As String
[...]
End Function
Public Function WEBDAVgetAllEmails(ByVal uri As String) As String
[...]
End Function
End Class
------------------------------
Il progetto VB.NET è di tipo "Class Library".
Compilo.
Se provo a regisrtare la DLL con regsvr32 mi dice che non trova il punto di partenza e non può registrarla...
Se provo ad utilizzarla da ASP con server.createobject ottengo solo un errore che dice che la stringa dell'interfaccia non è valida...
Che devo fare?
ciao
Giulio
Wamba
Profilo
| Expert
722
messaggi | Data Invio:
ven 16 mar 2007 - 13:17
Avvertimento: Se la DLL è complicata è una rogna grossa.
In generale entri nelle proprietà del progetto entri nel menù Compile e selezioni register for ComInterop.
Sappi però che hai parecchie limitazioni.
Es. Non esistono i costruttori con parametri.
-----------------------------------------------------------
Solo chi ha il Caos dentro può generare una stella danzante
Wamba
pons
Profilo
| Newbie
5
messaggi | Data Invio:
ven 16 mar 2007 - 13:25
grazie, ho messo il flag per COM interop.
Ho visto che mi ha creato anche un file tlb oltre alla dll.
Però se registro il file con regsrv32 il messaggio è lo stesso:
---------------------------
RegSvr32
---------------------------
nome.dll è stato caricato, ma il punto di ingresso DllRegisterServer non è stato trovato.
Questo file non può essere registrato.
---------------------------
OK
---------------------------
Altri suggerimenti?
Grazie in anticipo!
Wamba
Profilo
| Expert
722
messaggi | Data Invio:
ven 16 mar 2007 - 14:11
Per poterlo registrare devi creare uno strong name
1)Entri su i tool del visual studio da start e apri il prompt poi usi il comando sn -k e vedi gli altri parametri. ti crea un file snk.
2)Apri il File Assembly della tua DLL e aggiungi:
<Assembly: AssemblyKeyFile("C:\PathDelloStringName\NomeFileCheGliHaiDato.snk")>
a quel punto dovrebbe funzionare.
Per evitare problemi blocca l'Assemblyversion da <Assembly: AssemblyVersion("1.*.*.*")> a <Assembly: AssemblyVersion("1.0.0.0")>
Altrimenti rischi problemi sulle referenze.
Spero di non dimenticarmi niente.
-----------------------------------------------------------
Solo chi ha il Caos dentro può generare una stella danzante
Wamba
pons
Profilo
| Newbie
5
messaggi | Data Invio:
ven 16 mar 2007 - 14:42
ho fatto come hai detto:
ho creato c:\prova.snk facendo sn -k c:\prova.snk
ho aperto assemblyinfo.vb nella cartella del mio progetto (è questo l'assembly da modificare? non ce ne sono altri con il mio nome della della dll).
Ho aggiunto la riga <Assembly: AssemblyKeyFile("C:\prova.snk")> e ho tolto gli asterisci dalla riga dell'assemblyversion.
Ora il mio assembly è così:
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
' General Information about an assembly is controlled through the following
' set of attributes. Change these attribute values to modify the information
' associated with an assembly.
' Review the values of the assembly attributes
<Assembly: AssemblyKeyFile("C:\prova.snk")>
<Assembly: AssemblyTitle("")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("")>
<Assembly: AssemblyCopyright("")>
<Assembly: AssemblyTrademark("")>
<Assembly: CLSCompliant(True)>
'The following GUID is for the ID of the typelib if this project is exposed to COM
<Assembly: Guid("8CE22B46-24B8-44DE-B301-9999673534AB")>
' Version information for an assembly consists of the following four values:
'
' Major Version
' Minor Version
' Build Number
' Revision
'
' You can specify all the values or you can default the Build and Revision Numbers
' by using the '*' as shown below:
<Assembly: AssemblyVersion("1.0.0")>
------------------
ho ricompilato e ho rifatto regsvr32 nome.dll
ma ho ancora:
---------------------------
RegSvr32
---------------------------
nome.dll è stato caricato, ma il punto di ingresso DllRegisterServer non è stato trovato.
Questo file non può essere registrato.
---------------------------
OK
---------------------------
:-(
dov'e' l'errore?
ciao
giulio
Wamba
Profilo
| Expert
722
messaggi | Data Invio:
ven 16 mar 2007 - 15:42
>ho fatto come hai detto:
>
>ho creato c:\prova.snk facendo sn -k c:\prova.snk
>
>ho aperto assemblyinfo.vb nella cartella del mio progetto (è
>questo l'assembly da modificare? non ce ne sono altri con il
>mio nome della della dll).
>Ho aggiunto la riga <Assembly: AssemblyKeyFile("C:\prova.snk")>
>e ho tolto gli asterisci dalla riga dell'assemblyversion.
>Ora il mio assembly è così:
>
>
>
>Imports System
>Imports System.Reflection
>Imports System.Runtime.InteropServices
>
>' General Information about an assembly is controlled through
>the following
>' set of attributes. Change these attribute values to modify
>the information
>' associated with an assembly.
>
>' Review the values of the assembly attributes
>
><Assembly: AssemblyKeyFile("C:\prova.snk")>
><Assembly: AssemblyTitle("")>
><Assembly: AssemblyDescription("")>
><Assembly: AssemblyCompany("")>
><Assembly: AssemblyProduct("")>
><Assembly: AssemblyCopyright("")>
><Assembly: AssemblyTrademark("")>
><Assembly: CLSCompliant(True)>
>
>'The following GUID is for the ID of the typelib if this project
>is exposed to COM
><Assembly: Guid("8CE22B46-24B8-44DE-B301-9999673534AB")>
>
>' Version information for an assembly consists of the following
>four values:
>'
>' Major Version
>' Minor Version
>' Build Number
>' Revision
>'
>' You can specify all the values or you can default the Build
>and Revision Numbers
>' by using the '*' as shown below:
>
><Assembly: AssemblyVersion("1.0.0")>
>
>
>
>------------------
>
>
>ho ricompilato e ho rifatto regsvr32 nome.dll
>
>ma ho ancora:
>
>---------------------------
>RegSvr32
>---------------------------
>nome.dll è stato caricato, ma il punto di ingresso DllRegisterServer
>non è stato trovato.
>
>Questo file non può essere registrato.
>---------------------------
>OK
>---------------------------
>
>
>:-(
>dov'e' l'errore?
>
>ciao
> giulio
Prova ad usare
regasm /codebase miaDll.dll invece che regsvr32
al regasm ci accedi sempre come per lo strong name.
-----------------------------------------------------------
Solo chi ha il Caos dentro può generare una stella danzante
Wamba
pons
Profilo
| Newbie
5
messaggi | Data Invio:
ven 16 mar 2007 - 15:58
rieccomi qui...
mi ha detto "succesfully registered".
ora quando provo ad usarla dall'asp mi dice:
--------------------------------------------------------------------
Oggetto Server error 'ASP 0178 : 80070005'
Impossibile eseguire il metodo Server.CreateObject
/test.asp, line 11
Impossibile richiamare il metodo Server.CreateObject durante la verifica delle autorizzazioni. Impossibile accedere all'oggetto.
--------------------------------------------------------------------
la linea 11 è quella che fa il server.createobject
Di che autorizzazioni si tratta?
Wamba
Profilo
| Expert
722
messaggi | Data Invio:
ven 16 mar 2007 - 16:06
Molto probabilmente l'utente con cui gira l'asp non ha i permessi per la cartella o per la DLL. Prova a settare i permessi a everyone per una prova veloce... altrimenti devi mettere la DLL in GAC, ma è una noia. a quel punto ad ogni prova devi: compilare, registrare come hai fatto ora, mettere la dll in gac. e provare... per poter editare la dll devi PRIMA di aprire il VisualStudio togliere la dll Dalla gac, altrimenti ti si sfasano i riferimenti.
-----------------------------------------------------------
Solo chi ha il Caos dentro può generare una stella danzante
Wamba
pons
Profilo
| Newbie
5
messaggi | Data Invio:
ven 16 mar 2007 - 16:59
ce l'ho fatta.
bisogna de registrare la dll (regasm /u ...)
cambiare i permessi al file dll
riregistrare la dll.
grazie wamba.
:-)
ciao
Wamba
Profilo
| Expert
722
messaggi | Data Invio:
ven 16 mar 2007 - 17:18
niente... è dura lavorare con il ComInterop e non c'è poco poco online.
-----------------------------------------------------------
Solo chi ha il Caos dentro può generare una stella danzante
Wamba
Namelessx
Profilo
| Newbie
4
messaggi | Data Invio:
gio 21 feb 2008 - 09:47
come hai fatto a cambiare i permessi al file dll?
ale_fi
Profilo
| Newbie
32
messaggi | Data Invio:
lun 7 mag 2012 - 16:26
Non ha più risposto nessuno a questo interessante thread?
Torna su
Stanze Forum
Elenco Threads
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?
Dopo esserti registrato potrai chiedere
aiuto sul nostro
Forum
oppure aiutare gli altri
Consulta le
Stanze
disponibili.
Registrati ora !