You can make your DLL as COM compatible a way which I learned from an article:
[ComVisible(true)]
Also Register for COM interop checkbox should be checked from project properties->build page.
You can use Intellisense when using COM object with this:
[ClassInterface(ClassInterfaceType.AutoDual)]
After all you can use DLL yet from your COM compatible language (except there is no binding). When you try to use you get an error; "OLE IDispatch exception code 0 from System.ServiceModel: ServiceModel...". You have to copy app.config file as yourexefile.EXE.app.config or add these red code parts to your class (I got help for this from Paul Mrozowski):
For add this sample web service to your project, you have to right click at Service References than Add Service Reference-> write https://tckimlik.nvi.gov.tr/Service/KPSPublic.asmx to address and push GO.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
using System.ServiceModel;
namespace TCKimlik
{
[ComVisible(true)] //for visible COM object
[ClassInterface(ClassInterfaceType.AutoDual)] //for intellisense at using COM
[ProgId("TCKimlik.TCSorgula")] //COM object name
public class TCKimlikClass
{
public bool Dogrula(string adi,string soyadi,Int64 tc,Int32 dogumT)
{
bool ret = false;
//------ for using COM compatible DLL without APP.CONFIG
BasicHttpsBinding binding = new BasicHttpsBinding();
EndpointAddress address = new EndpointAddress("https://tckimlik.nvi.gov.tr/Service/KPSPublic.asmx");
//------ run --------
try
{
Sorgula.KPSPublicSoapClient servis = new Sorgula.KPSPublicSoapClient(binding, address);
ret = servis.TCKimlikNoDogrula(tc, adi, soyadi, dogumT);
}
catch
{
}
return ret;
}
}
}
Now you can use this DLL at COM compatible languages plus .NET. But if you move DLL to client computer without setup you have to register with regasm. I shared project.
There is a sample usage with Microsoft Visual Foxpro:
o=CREATEOBJECT("tckimlik.tcsorgula")
?o.Dogrula("METİN","EMRE",11111111111,1980)
10 Şubat 2015 Salı
C# - Create COM compatible DLL and use without app.config file with a web service consume
Etiketler:
0,
app.config,
C#,
COM DLL,
exception code,
IDispatch,
OLE,
service,
System.ServiceModel,
web,
without
23 Ocak 2015 Cuma
JAVASCRIPT - Solve 403.14 - Forbidden error
I intended learn to Javascript
and got "HTTP Error 403.14 - Forbidden..." error at first try. I found the solution from a blog. Move to "C:\Program Files\IIS Express" (It may different at your computer) folder and run this command:
appcmd set config /section:system.webServer/directoryBrowse /enabled:true
appcmd set config /section:system.webServer/directoryBrowse /enabled:true
Etiketler:
03.14,
403,
aptana,
eclipse,
error,
forbidden,
javascript,
visual studio
2 Ocak 2015 Cuma
SQL SERVER - If noone has Sysadmin rights or SA password is lost?
Go to pproperties of relates servers from SQL Server Configuration Manager. Advanced->Properties than put "-m" parameter. Carefull about you have to put ";" after last parameter and put no space! I mean ";-m" (Without quotes).
Restart to SQL Server. Server will run in single mode.
Run SQLCMD.EXE as administrator. Give Sysadmin rights to your Windows user which you use at login for your SQL Server:
EXEC sp_addsrvrolemember "myserver\myuser","sysadmin";
GO
or
EXEC sp_password NULL, 'newpwd', 'sa';
GO
Don't forget delete parameter and restart server at regular mode!..
Source:
http://blogs.msdn.com/b/raulga/archive/2007/07/12/disaster-recovery-what-to-do-when-the-sa-account-password-is-lost-in-sql-server-2005.aspx
Restart to SQL Server. Server will run in single mode.
Run SQLCMD.EXE as administrator. Give Sysadmin rights to your Windows user which you use at login for your SQL Server:
EXEC sp_addsrvrolemember "myserver\myuser","sysadmin";
GO
or
EXEC sp_password NULL, 'newpwd', 'sa';
GO
Don't forget delete parameter and restart server at regular mode!..
Source:
http://blogs.msdn.com/b/raulga/archive/2007/07/12/disaster-recovery-what-to-do-when-the-sa-account-password-is-lost-in-sql-server-2005.aspx
25 Aralık 2014 Perşembe
AX 2012 - Consume web service with sample turkish citizen ID check
I used a blog when developing this sample. You can download to ready use XPO from there .
1- Create a new Class Library type C# project at Visual Studio.
2- Press right click at project name, select Add service reference and write https://tckimlik.nvi.gov.tr/Service/KPSPublic.asmx?WSDL to Address, write Sorgula to Namespace and press GO so service reference will be shown.
3- Add your project to AOT with Add to AOT .
4- Go to project properties and make
Debug Target = No
Deploy to Client = Yes
Deploy to EP = No
Deploy to Server = Yes
Deploy to SSRS = No
5. Deploy project and down all AX clients. If you don't down all clients at deploy, deploy will fail accoring to blog writer.
This is my sample job:
//Metin Emre, 2.10.2014
static void TCIDTest(Args _args)
{
CLRObject clientType;
TCKimlik.Sorgula.KPSPublicSoapClient cl;
System.Exception ex;
boolean s,erOccured;
System.Exception e;
str ret;
new InteropPermission(InteropKind::ClrInterop).assert();
try
{
clientType = CLRInterop::getType("TCKimlik.Sorgula.KPSPublicSoapClient");
cl = AifUtil::createServiceClient(clientType);
s = cl.TCKimlikNoDogrula(11111111111,"METİN","EMRE",1999);
}
catch(Exception::CLRError)
{
Ex=CLRInterop::getLastException();
ret = Ex.ToString();
if (!strScan(ret,"Not a valid citizen ID",1,strLen(Ret)))
{
info(Ex.ToString());
erOccured = true;
}
}
if (!erOccured)
info(strFmt("%1",s));
}
11111111111 is citizen ID, name and surname after citizen ID and the last born year. If all these are correct, returns true else false.
1- Create a new Class Library type C# project at Visual Studio.
2- Press right click at project name, select Add service reference and write https://tckimlik.nvi.gov.tr/Service/KPSPublic.asmx?WSDL to Address, write Sorgula to Namespace and press GO so service reference will be shown.
3- Add your project to AOT with Add to AOT .
4- Go to project properties and make
Debug Target = No
Deploy to Client = Yes
Deploy to EP = No
Deploy to Server = Yes
Deploy to SSRS = No
5. Deploy project and down all AX clients. If you don't down all clients at deploy, deploy will fail accoring to blog writer.
This is my sample job:
//Metin Emre, 2.10.2014
static void TCIDTest(Args _args)
{
CLRObject clientType;
TCKimlik.Sorgula.KPSPublicSoapClient cl;
System.Exception ex;
boolean s,erOccured;
System.Exception e;
str ret;
new InteropPermission(InteropKind::ClrInterop).assert();
try
{
clientType = CLRInterop::getType("TCKimlik.Sorgula.KPSPublicSoapClient");
cl = AifUtil::createServiceClient(clientType);
s = cl.TCKimlikNoDogrula(11111111111,"METİN","EMRE",1999);
}
catch(Exception::CLRError)
{
Ex=CLRInterop::getLastException();
ret = Ex.ToString();
if (!strScan(ret,"Not a valid citizen ID",1,strLen(Ret)))
{
info(Ex.ToString());
erOccured = true;
}
}
if (!erOccured)
info(strFmt("%1",s));
}
11111111111 is citizen ID, name and surname after citizen ID and the last born year. If all these are correct, returns true else false.
29 Eylül 2014 Pazartesi
AX 2012 - R3 Installation
In first check minimum system requirements . MS-SQL collate doesn't installed as turkish. With turkish like SAP
and Oracle you'll have problems about "i" letter of turkish, after AX 2012 install, at database sync, installation will fail.
I used Dilip's Blog for installation instead of Microsoft's long and complex white paper. Installation of AX 2012 is so easy of it's mine change. :)
In first Active Directory should be installed. There are plenty of pages about AD installation at Google.
I just used basic AX 2012 like Dilip's, let SSRS etc. installation later. AX 2012 setup gives prerequisities links and configures some of prerequisities automatically. I didn't faced any problem at installation.
After installation I upload demo data again from a blog page . Demo installation was harder than AX 2012 installation.
I installed SQL Server SSRS add-in and configured look from a blog . Anyway for developing SSRS reports (Doesn't require for deploy) don't forget install Business Intelligence Development Studio from SQL Server Setup. SSRS configure was so easy; in order run Service account, Web service URL, Database, Report Manager URL tabs with defaults was enough.
Again I used another Dilip page for SSRS install. I haven't got any trouble and didn't need Dilip's manual complete way for install, reports deployed smootly. :)
I used Dilip's Blog for installation instead of Microsoft's long and complex white paper. Installation of AX 2012 is so easy of it's mine change. :)
In first Active Directory should be installed. There are plenty of pages about AD installation at Google.
I just used basic AX 2012 like Dilip's, let SSRS etc. installation later. AX 2012 setup gives prerequisities links and configures some of prerequisities automatically. I didn't faced any problem at installation.
After installation I upload demo data again from a blog page . Demo installation was harder than AX 2012 installation.
I installed SQL Server SSRS add-in and configured look from a blog . Anyway for developing SSRS reports (Doesn't require for deploy) don't forget install Business Intelligence Development Studio from SQL Server Setup. SSRS configure was so easy; in order run Service account, Web service URL, Database, Report Manager URL tabs with defaults was enough.
Again I used another Dilip page for SSRS install. I haven't got any trouble and didn't need Dilip's manual complete way for install, reports deployed smootly. :)
26 Eylül 2014 Cuma
AX 2012 - If batch jobs cannot start?
If you look up Home->Inquiries->Batch jobs->My batch jobs and see batch jobs don't start.
Go System administration->Setup->System->Server configuration and check there is a record at Batch server schedule with proper time gap (00:00 -23:59) and be careful about Maximum batch threads value bigger than zero.
Also problem maybe about there is no attached server to batch group :
Administration -> setup -> Batch Groups
Find empty batch group and go Batch Servers tab, look for Selected server field has correct server value.
Go System administration->Setup->System->Server configuration and check there is a record at Batch server schedule with proper time gap (00:00 -23:59) and be careful about Maximum batch threads value bigger than zero.
Also problem maybe about there is no attached server to batch group :
Administration -> setup -> Batch Groups
Find empty batch group and go Batch Servers tab, look for Selected server field has correct server value.
15 Eylül 2014 Pazartesi
AX 2012 - Create a new financial dimension which related a table(s)
I found the easy way that the way from a blog which referred Microsoft'un related white paper:
1-Duplicate one of views from AOT which beginned DimAttribute and new views name should be begin same DimAttribute word.
2. Main datasource name should be BackingEntity unrelated what name used with original table name.
3. All field names of view should be like these whatever original names:
Key - data source tables Surrogate key field. Like RecId...
Value - data source tables primary key . Like AccountNum...
Name - Description field. Like Description or CustomerName...
There are two ways to use this new dimension implementation:
AOS restart
or
DimensionCache::clearAllScopes();
command.
1-Duplicate one of views from AOT which beginned DimAttribute and new views name should be begin same DimAttribute word.
2. Main datasource name should be BackingEntity unrelated what name used with original table name.
3. All field names of view should be like these whatever original names:
Key - data source tables Surrogate key field. Like RecId...
Value - data source tables primary key . Like AccountNum...
Name - Description field. Like Description or CustomerName...
There are two ways to use this new dimension implementation:
AOS restart
or
DimensionCache::clearAllScopes();
command.
Kaydol:
Kayıtlar (Atom)