2009年9月11日

[WCF] HTTP could not register URL (your wcf url) .Your process does not have access rights to this namespace

While hosting BasicHttpBinding WCF service in windows service , I came accross the following error.

HTTP could not register URL (your wcf url) .Your process does not have access rights to this namespace

The error occurs due to the service account does not have access rights to the namespace.

This is a HTTP WCF Service delegated error, (in other words, this won’t occur if you are hosting Named-Pipe WCF serivces)

To grant the service account access right, in Windows 2008

  1. Open command prompt with administrator account
  2. Execute the following command

netsh http add urlacl url=YourWCFURL user=DOMAIN\username

You should get a message saying “URL reservation successfully added


Reference:

2009年9月10日

[SSIS] Invoke external assembly from SSIS ScriptTask job

To Invoke external assembly from SSIS package, the assembly has to be

  1. Strong named
  2. GAC-ed

From ScriptTask job component, add the assembly reference via SSIS Script designer.

reference

2009年7月22日

[.Net]Invoking 32 bit COM on 64 bit OS

There are chances you have to invoke legacy 32 bit COM from 64 bit application. The most common exception I’ve got is the error code 800a0035.

Basically the error code 800a0035 is about the 64 bit process (your application )could not retrieve 32 bit COM information from 64 bit registry. Scott Hanselman had a blog post detailing this issue.

So to make your 32 bit COM works on 64 bit server, when compiling your applicaiton, change active solution platform from [Any CPU] to [X86] to make this application a 32 bit application.

image

2009年7月15日

[SSRS2008] Several Issues

  1. While creating scheduled task via SSRS web service, I got an [OperationalNotSupportedNativaModeException].
    1. When the Reporting Service is set to Native Mode, you should reference to ReportingService2005.asmx instead of ReportingServivce2006.asmx
  2. Programicaly create SSRS Snapshot report with parameters
    1. SSRS does not support parameterized snapshot (unless you set default parameters), to programicaly create parameterized snatshop.
            ReportingService2005 svc = new ReportingService2005();
svc.Credentials = System.Net.CredentialCache.DefaultCredentials;

svc.SetReportParameters("/ReportsTest/UsersReport", new ReportParameter[]{
new ReportParameter{
Name="userID",
DefaultValues = new string[]{"John Don"}
}
}
);
ReportingService2005.Warning[] warnings = null;
string id = svc.CreateReportHistorySnapshot("/ReportsTest/UsersReport", out warnings);


 

2009年4月27日

[BizTalk]Could not store transport type date for Receive location

I got this error message when trying to deploy BTS assembly and to Stop/Start existing applicaiton.

Could not store transport type data for Receive Location ‘Recv.Loc’ to config store. Primary SSO Server ‘Sql-server’ failed. The external credentials in the SSO database are more recent.

This error occurs due to the system date is not in correct date, I did change the system date for some tests, so to correct SSO db, execute the following script against SSO db.

update SSODB..SSOX_ExternalCredentials 
set ec_timestamp = dateadd(m,-1,ec_timestamp)
where datediff(m,ec_timestamp,getdate())<>0

update SSODB..SSOX_ExternalCredentials
set ec_timestamp = dateadd(year,-1,ec_timestamp)
where datediff(year,ec_timestamp,getdate())<>0

2009年4月22日

[WCF]CommunicationException when invoking Web Service via WCF Client

I added aweb service as a Service Reference in VS2008, while invoking, a CommunicationException was thrown indicate that WCF could not serialize response message due to XmlNameTable legth exceed maxinum allowed.

CommunicationException can be throw in various scenario. In my case, the exception message has indicate that XmlNameTalbe name has exceed the max length.

We can fix this by modifying app.config.

Open the app.config, find the basicHttpBinding section(since this is a regula web service, it has to be basicHttpBinding). Find related attribute and change the value to an acceptable value. In my case the attribute will be [maxNameTableCharCount]

    <bindings>
<basicHttpBinding>
<binding name="WebService_SIPSoap" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="2147483647" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>

[WCF][VS2008] How to add web reference in VS2008

Right click on [Server Reference] then [Add Service Reference…]

sc_1.jog

On the Popup dialog, Click on [Advenced…]

sc_2

Click on [Add Web Reference…]

sc_3.jog

Now you can add Web Reference here

sc_4.jog

2009年4月17日

[SQL] Could not open a connection to SQL Server Error 53 while setting up Linked Server on SQL 2005

When trying to setup Linked Server on SQL 2005, I got [Name Pipe Provider: Could not open a connection to SQL Server [53]] error message.

Error 53 is basically a OS level error which maps to ERROR_BAD_NETPATH (network path not found). Which usually means that the SQL process have no access to remote server you are trying to connect. So here are some thing you may want to check first.

  1. Check if your SQL service account has network access.
  2. Check if your SQL server is able to resolve the remote server name. If not, add a record to host file, or add an alias for the remote server in SQL configuration Manager.
  3. Force using TCP/IP procotol instead of named pipes by prefixing the server name with “tcp:” or by setting protocol order via SQL Configuration Manager

2009/4/29 - There could be an error occur while adding a 32 bit SQL Server to a 64 bit SQL Server as a linked server, in that case, please refer to this kb article.

2009年4月16日

[VPC] Disable host time sync

I happen to have a PDC (Windows Server 2003 R2) inside a VM running on Virtual Server 2005. For testing purpose, we have to forward it’s time clock to 1 month after. To fully disable timesync feature on the VM. We have to  disable time sync feature of the OS and of the Virtual Server.

To disable time sync of Virtual Server 2005, open the Virtual Server 2005 management console, there’s a checkbox on the [Virtual Machine Additionals] tab, simply shutdown the OS, check this option and restart the VM.

To disable time sync of a PDC, which is more cpmplicate since a root PDC is also a time server for it’s AD. Follow the instruction to configure time service on the PDC.

In additional, to disable host time sync in VPC 2007, open the .vmc file via notepad, it’s a xml formatted document, add the following elements to the file or modify existing element.

<integration> 
<microsoft>
<mouse>
<allow type="boolean">true</allow>
</mouse>
<components>
<host_time_sync>
<enabled type="boolean">false</enabled> <!—- add here… -->
</host_time_sync>
</components>
<!-- other settings -->
</microsoft>
</integration>

2009年4月9日

[SQL] FOR XML Clause and ExecuteScalar()

When reterive data via ExecuteScalar() against a SQL statement with FOR XML Clause, you may find that return value is truncate at 2033 characters.

SQL Server 2005 seperates xml result into multi rows of 2033 characters each when FOR XML clause creates xml data greater than 2033 characters.

To avoid this behavior from impact you code, use other Execute() method instead and concate each row in code, or, in your stored procedure declare a variable in xml type, select this variable instead of select directly.

Declare @xml xml
set @xml = (Select …… for Xml raw,Elements)
select @xml

2009年2月9日

[Windows7] Office 2007 on Windows 7

Office 2007 prompt the following error on Windows 7

登錄VB Script DLL 失敗,請重新安裝或執行 Regsvr32.exe Vbscript.dll 來進行登錄

And this error stills even if I register vbscript.dll with Regsvr32.exe.

This error occurs due to the incompatible between OS language and Office language, but we can fix this by correcting Office’s language setting via [Start]->[Programs]->[Microsoft Office]->[Microsoft Office Tools]->[Office 2007 Languages]

Capture

Just correct the language setting here and you office 2007 should be working fine with Windows 7.

[BizTalk] Promote Property in Orchestration

We can easily promote properties in pipeline by code, but how can we promote properties in orchestration ?

Although BizTalk does not provide a built-in function to do this, we can still promote properties in an Orchestration by creating a correlation set and initialize the created correlation set in a send shape (in Direct binding scenario). We don’t have to create a following-correlation-set since the created correlation set is only for promoting properties, not for correlation.

Note that, a correlation set is a set of properties which Orchestrations subscribe them for correlation, since these properties has to be subscribed for routing purpose, these properties are automatically promoted when they were added into a correlation set.

2009年2月4日

[BizTalk] Invoke web service dynamically in Orchestration

There’re times you have to invoke various web method of one single web service in orchestration. To create a dynamic send port is not a solution since the [Operation] name of the dynamic send port has to be exactly the same with the web method you are to invoke.

However, this can be done with a static SOAP send port.

First we create a webservice proxy assembly, and setup a SOAP send port with the assembly specified in SOAP Adapter configuration page. Note that in the [Method] combobox, we have to select [Specify later]

Now return to your orchestration, create a configured port on the port surface, and a [Expression] shape before [Send] shape.

In [Expression] shape, use the following script to specify Method name of the proxy class.

outputMessage(BTS.MethodName) = "YourWebMethodName";


[BizTalk] Transform dynamically in Orchestration

To dynamically transform one message to another, we need to create mapper object on our own rather then use the Transform shape provided by BizTalk Server.

When we create and deploy a BizTalk Mapper, BTS Engine compiles the created mapper (btm file) into a .Net type, so what we need to do is to obtain the mapper class type and then invoke BizTalk buildin function “transform”to do the transformation.

To obtain mapper type, simply drag an Expression shaep into the orchestration and type the following script in it

var_mapper = Type.GetType(MapperFullQualifiedName);






And in a [Construct Message] shape





transform(outputMessage) = var_mapper(inputMessage)


Blog Archive

About Me