I don't know if this is counted as a bug, but I am sure that is definitely wrong. I am working with three projects: two silverlight projects A and B, and a silverlight class library projet C. There are some common tasks that both A and B need to accomplish, so I put them into project C and both A and B reference to C. In project C a WCF servic is invoked. vs2012 creates for C a client config file to reference to WCF service. The key content of the config file is below:
<endpoint address="http://localhost:15154/StaffService.svc"
binding="..." bindingConfiguration="..."
contract="..."
name="..." />
Please note that the address is absolute uri. At runtime the codes in C which invoke WCF service use in the fact the client config file of his invoinking application here named A and B. So I imitate what vs does for silverlight application and creat by hand in projects A and B client cofig file with relative uri like belows and delete the client config file in C.
<endpoint address="../StaffService.svc"
binding="..." bindingConfiguration="..."
contract="..."
name="..." />
This relative uri means that service client classes in C are going to locate config from the parent folder of where A and B as xap is downloaded. So far everything is going all right till I publish the web site which holds A and B.
I am very satified with the performance of my projects in developing enviornment and a damper hited me in front of quite some VIPs right after I deployed them. The program does nothing. The screen is just a white paper.
After a whole day's digging, I found that the class libray C worked not. And the source of the problem is client config file in xap. Despite I have manually created config file with relative path, in the client config file in xap(how to see it: rename .xap to .zip and then open it as normal zip file), it was modified again into the abosolute uri like the first one:
address="http://localhost:15154/StaffService.svc"
It certainly could not find any service at that address at runtime. I guessed what has tooken place: When I publish web site, vs recreates new client config files for each project which reference to WCF service and add this new created config file but not the one I manually created into xap.
Is there any remedial measures for tis problem?
I am feeling I am very unlucky that new problems emerged after I manually turned the uri back to right. The client browser loads always the old version of the application. I have tried to clear application cache using mage -cc, using Siverlight configuration tool at client, restarting IIS etc. All of them function not. I don't know if the following problems are related with I modifing the xap(I doesn't check Signing the xap file).
I must continue to struggle with them. God help me.