View Full Version : Error Consuming a WCF service on DiscountASP servers
jfasenmyer
01-08-2008, 11:22 AM
I have multiple WCF services that I've published to my DiscountASP account. All services appear load correctly when directly referenced, https://www.domain.com/Services/AccountServices.svc. The services are currently unsecure aside from being referenced via https for simplicity. I've successfully added the service references to my ASP.NET website project. When I run the site project on my local development workstation, the application calls the services (hosted on the DiscountASP server) successfully without any issues. However when I publish the site to my DiscountASP account, I receive the following error...
http://www.resvendors.com/parsererror.jpg
I've tried changing the bindings from wsHttpBindings to basicHttpBindings and receive the same error. I've also attempted publishing the site to my IIS 7 beta account on DiscountASP (my workstation is running Vista so I thought perhaps it was an IIS 6 / 7 issue) and still receive the same error. I've hashed and rehashed the Reference.svcmap files all afternoon but if the problem is a bad or invalid value in the svcmap file, why would itrun and connect frommy local machine correctly? I believe the problem may be related to the ASP.NET site resolving the service addresses which reside on the same account but have no method of testing or confirming any of this due to it being a hosted server.
Below are the binding and endpoint values for one of the services (they are all the same format) thatVS 2008auto-generates when I add the service references...
[quote]
[b]
[b]
[b]
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="Transport">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://www.domain.com/Services/AccountServices.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IAccountServices"
contract="Accounts.IAccountServices" name="BasicHttpBinding_IAccountServices" />
</client>
Any advice, suggestions, etc are greatly appreciated as I cannot currently publish the site and am completely out of ideas. Thank you!
Post Edited (jtf) : 1/9/2008 3:11:29 PM GMT
jfasenmyer
01-09-2008, 10:41 AM
Let me simplify my request... does anyone have a working WCF serviceAND applicationutilizing the service on the DiscountASP servers? I would about give anything for a working HelloWorld example with functioning binding and endpoint settings.
wisemx
01-09-2008, 11:30 AM
<STRIKE>I'll try and work on one tonight bro.
<STRIKE>Haven't yet however.
OhMyGosh...Didn't realize how deep WCF was. http://community.discountasp.net/emoticons/wink.gif
Found a bunch of samples here if they can help you run some tests:
http://msdn2.microsoft.com/en-us/library/ms752239.aspx
Salute,
Mark
Post Edited (wisemx) : 1/10/2008 12:59:41 AM GMT
jfasenmyer
01-10-2008, 02:45 AM
Hi Mark, I'll give these a shot and see if I can get them working on the DASP servers. If I manage to get one working, I'll be sure to post it to help anyone else out who may eventually encounter this. The binding & endpoint settings can be simplified further than what is auto-generated by Studio but it still fails to work when I publish to the DASP servers. Thanks!
wisemx said...
<STRIKE>I'll try and work on one tonight bro.
<STRIKE>Haven't yet however.
OhMyGosh...Didn't realize how deep WCF was. http://community.discountasp.net/emoticons/wink.gif
Found a bunch of samples here if they can help you run some tests:
http://msdn2.microsoft.com/en-us/library/ms752239.aspx
Salute,
Mark
jfasenmyer
01-10-2008, 08:43 AM
I've broken this issue down to the simplest form of a HelloWorld client and service project (thanks again Mark for steering me in that direction). I've identified that the Reference.svcmap files auto-generated by VS 2008 will not work at allwhen published to theDiscountASP servers. Attempting to do so produces the error I've listed above. Due to my limited access, I don't know why this is. Running the ASP.NET consumer project from my local workstation (Vista with IIS 7) runs without issue. DiscountASP has provided a solution to the multiple header issue (http://community.discountasp.net/default.aspx?f=24&m=16709&g=19956#m19956) experienced when attempting to publish WCF services to their servers. However there appears to be no follow up to the requests at the bottom of the thread asking for a sample application which includes a project consuming the actual service itself.
After spending yet another day troubleshooting this, I've found completely removing the App_WebReferences (where the svcmap file resides), copying all WCF service interfaces into your site project and then manually creating the channel, endpoint & binding in code (see below) DOES work.
[quote]
BasicHttpBinding basicBinding = new BasicHttpBinding();
EndpointAddress endPoint = new EndpointAddress("http://www.domain.com/DASPService/Service.svc");
ChannelFactory<IService> daspChannel = new ChannelFactory<IService>(basicBinding, endPoint);
IService daspService = daspChannel.CreateChannel();
Response.Write(daspService.SayHello());
daspChannel.Close();</CODE>The problem with this work around is that if your service interface (contract) returns or uses custom class parameters, you're stuck duplicating these class files between your consumer ASP.NET project and your WCF service project. I'm close to opening a paid support call for help with Microsoft but what is the response going to be when I tell them that it works until I copy it to my hosting provider's server?
Has anyone managed to get a client and service project running on the DiscountASP servers? Has DiscountASP? Getting the servicepage to render is nice but if you can't consume the service, what good is it?
I will upload my sample HelloDASP service, auto-gen'd client (not working) and custom workaround client projects shortly. Perhaps the support gods will bring blessings upon thee with any kind of response. Until then, I will continue todocument my own progress.
Post Edited (jtf) : 1/10/2008 9:02:28 PM GMT
wisemx
01-10-2008, 08:59 AM
I like the way you're handling this, very cool.
One thing I ran into yesterday, inthe MSDN WCF swamp, was references to Hosts running in WCF Services compatibility mode.
Apparently there are some settings you canset to change this compatibility behavior on shared hosts.
I have no idea how DASP is running these services, and again I haven't done a lick of code with WCFyet.
But that's something I'd suggest you look into...And yes, please do keep us posted.
Salute,
Mark
P.S. I can't think of any WCF services to add to: http://sdknuts.net
But I'm always up to a good community project to test this.
jfasenmyer
01-11-2008, 03:17 AM
Day 4, still no sign of support. I've started burning officefurniture for warmth as I huddle around my forum post waiting in hopes of an officialDASP response. Most of the nearby fast food chains won't serve me due to thestench after 4 days without a shower. My co-workers have started a petition to force the shower issue. My faith thatanyone is activelyconsuming WCF services on the DASP servers is faltering. In the meantime, I'm uploading my custom HelloDASP WCF and client folders in further hopes of displaying that even a simple HelloWorld WCF client does not work for some unknown reason on the DASP servers...
DASPService - A simple WCF service using httpBasicBinding with a single method, SayHello. Method returns "Hello DASP!".
DASPClient_Custom - Client ASP.NET site that manually createsthe channel, binding & endpoints to call the service. This is the workaround I've found, however you need to include the service interface class and all custom classes that the interface classes use (return values & parameters). While this works for a simple HelloWorld example, it's not so great with a 'real world' project that uses a good number of custom classes as return values and/or parmeters.
DASPClient_AutoGen - A copy of the DASPClient_Custom site but with services added via the VS 2008 IDE (Add Service Reference). This creates the App_WebReferences folder and the svcmap config file (along with the wsdl, schema & disco) which causes the project, when published to the DASP servers, to crash. However, it runs perfectly fine on my local workstation.
Please note that you will need to update the http://www.domain.com/DASPService/Service.svcreference with your own domain name and pathing if you've placed it elsewhere. Also all 3 will need to be configured as applicationswith the Web Application Tool.
Post Edited (jtf) : 1/11/2008 6:50:36 PM GMT
wisemx
01-11-2008, 03:36 AM
<STRIKE>You're cracking me up bro...I've D/L'd the file and will look into it soon. http://community.discountasp.net/emoticons/tongue.gif
I'm stuck.
Placed your files on the server, made the necessary changes, created an application for /services/
Have duplicated the services files...
But still the service fails and I can't figure out why so far.
http://sdknuts.net/service/DASPClient_Custom/
http://sdknuts.net/service/DASPClient_AutoGen/
One thing that bothers me about the code currently would be the multiple web.config files.
Another is the services aren't in a better location, the \App_Code\ folder.
But I duplicated it and still got the same result.
That's where I'm stuck, but the compilation output does show an access denied behavior...
However that could be because of the IService resource error.
Yeah, I'm stuck...But at least wanted to give you this much.
Salute,
Mark
Post Edited (wisemx) : 1/11/2008 4:26:44 PM GMT
jfasenmyer
01-11-2008, 05:52 AM
The IService.cs class should've been included in both projects in the App_Code folder. You can find this class in the DASPService if you want to try copying it over. I'll update the zip in a few. Sorry about that! I've spent a lot of time messing with these so I likely deleted it prior to creating the zip. Your help is tremendously appreciated.
wisemx said...
<STRIKE>You're cracking me up bro...I've D/L'd the file and will look into it soon. http://community.discountasp.net/emoticons/tongue.gif
I'm stuck.
Placed your files on the server, made the necessary changes, created an application for /services/
Have duplicated the services files...
But still the service fails and I can't figure out why so far.
http://sdknuts.net/service/DASPClient_Custom/
http://sdknuts.net/service/DASPClient_AutoGen/
One thing that bothers me about the code currently would be the multiple web.config files.
Another is the services aren't in a better location, the \App_Code\ folder.
But I duplicated it and still got the same result.
That's where I'm stuck, but the compilation output does show an access denied behavior...
However that could be because of the IService resource error.
Yeah, I'm stuck...But at least wanted to give you this much.
Salute,
Mark
wisemx
01-11-2008, 05:56 AM
No prob, I had to remove some of the references quick, they were affecting my site.
(Dropped your CS code in my VB APPcode, duh.)
jfasenmyer
01-11-2008, 06:51 AM
I've updated the zip to include the IService.cs file.
wisemx
01-11-2008, 09:19 AM
I made some physical changes and did make some progress.
At least got it to the point where it would end with a parse error on the Host.
I attached my changes, take a look and see if you can do any better with this one.
Would take me at least a week or two to get used to these new services and the xml formatting.
Salute,
Mark
jfasenmyer
01-14-2008, 04:00 AM
Were you receiving the same parser error as the one I originally posted? I'm almost convinced at this point that the DASP IIS is not handling svcmap files correctly. Unfortunately, I have no way of further troubleshooting this due to my limited access and their reply buttons appear to be broken at the moment.
[quote]
wisemx said...
I made some physical changes and did make some progress.
At least got it to the point where it would end with a parse error on the Host.
I attached my changes, take a look and see if you can do any better with this one.
Would take me at least a week or two to get used to these new services and the xml formatting.
Salute,
Mark
Post Edited (jtf) : 1/14/2008 6:27:17 PM GMT
wisemx
01-14-2008, 05:26 AM
No I didn't get to the parser until I reconstructed that.
I'm pretty sure with a couple of weeks studying it I could find out what the problem is.
One thing I meant to do that last time as update the web.config for .NEt 3.5, but didn't.
Aristotle
01-14-2008, 08:50 AM
Have you tried the sample WCF service here. The original post has a zip of a very simple service.
http://community.discountasp.net/default.aspx?f=24&m=16709
In the Services.cs, change the code to match your serivice URL in the CreateServiceHost override method.
In the Web.config, change the service binding from wsHttpBinding to basicHttpBinding.
Create a web reference in your client application like you would normally do an ASMX web service, referencing http://www.domain.com/WCFService/Service.svcor whatever your URL instead.
[/url]
Aristotle
DiscountASP.NET
[url="http://www.DiscountASP.NET"]www.DiscountASP.NET (http://www.domain.com)
jfasenmyer
01-14-2008, 10:10 AM
Hi Aristotle,
Thank youfor the response! I'velooked atthe sample WCF service (reference it above) and even created the channel factory as you instructed. It works great and resolves the multiple host header issue which I initially encountered. I've also tested adding the WCF service as an ASMX web service. This also works but I don't understand why can't I add the WCF service as a WCF service and take advantage of the wsHttpBinding features. Does DASPhave any plans of supporting any bindings other than the basicHttpBinding?
I understand this is all still very new but with VS 2008 hitting retail soon, I doubt I'm going to be theonlydeveloper who wants take advantage of some of the new features offered with .NET 3.5. If DASP is only supporting the basicHttpBinding for now, I can live with that but I just wanted to verify that the parser error when adding a WCF service as a WCF service was not just on my end. Thanks again!
Aristotle [DASP] said...
Have you tried the sample WCF service here. The original post has a zip of a very simple service.
http://community.discountasp.net/default.aspx?f=24&m=16709
In the Services.cs, change the code to match your serivice URL in the CreateServiceHost override method.
In the Web.config, change the service binding from wsHttpBinding to basicHttpBinding.
Create a web reference in your client application like you would normally do an ASMX web service, referencing http://www.domain.com/WCFService/Service.svcor whatever your URL instead.
Post Edited (jtf) : 1/14/2008 10:17:44 PM GMT
Aristotle
01-16-2008, 04:49 AM
I'll have to check my samples again for implementing wsHttpBinding. It's been a while since I looked atWCF. I do remember that with it's default settings of using Windows authentication, I could getit to work ifthe service and client apps wereon the same site. Working across the internet could be trickier.
jtf said...
Hi Aristotle,
Thank youfor the response! I'velooked atthe sample WCF service (reference it above) and even created the channel factory as you instructed. It works great and resolves the multiple host header issue which I initially encountered. I've also tested adding the WCF service as an ASMX web service. This also works but I don't understand why can't I add the WCF service as a WCF service and take advantage of the wsHttpBinding features. Does DASPhave any plans of supporting any bindings other than the basicHttpBinding?
I understand this is all still very new but with VS 2008 hitting retail soon, I doubt I'm going to be theonlydeveloper who wants take advantage of some of the new features offered with .NET 3.5. If DASP is only supporting the basicHttpBinding for now, I can live with that but I just wanted to verify that the parser error when adding a WCF service as a WCF service was not just on my end. Thanks again!
Aristotle [DASP] said...
Have you tried the sample WCF service here. The original post has a zip of a very simple service.
http://community.discountasp.net/default.aspx?f=24&m=16709
In the Services.cs, change the code to match your serivice URL in the CreateServiceHost override method.
In the Web.config, change the service binding from wsHttpBinding to basicHttpBinding.
Create a web reference in your client application like you would normally do an ASMX web service, referencing http://www.domain.com/WCFService/Service.svcor whatever your URL instead.
Aristotle
DiscountASP.NET
www.DiscountASP.NET (http://www.DiscountASP.NET)
jfasenmyer
01-17-2008, 05:58 AM
A working wsHttpBinding sample that works on the same site would be a tremendous help if you can post it. I'm looping back to my own site for the services, this is when I receive the parser error. The service are in a seperate project file but that's about it. My biggest problem is I'm completely out of ideas as to why the site dies on the auto-generated svcmap when I publish to the DASP IIS. Runs ok locally and even connects to the services I've copied to my DASP account but then I'm also running Vista /IIS 7.
[quote]
Aristotle [DASP] said...
I'll have to check my samples again for implementing wsHttpBinding. It's been a while since I looked atWCF. I do remember that with it's default settings of using Windows authentication, I could getit to work ifthe service and client apps wereon the same site. Working across the internet could be trickier.
jfasenmyer
01-21-2008, 10:41 AM
Update: Tried switching authentication from Forms to Windows as you suggested and Istill getting the parser error. We're not even talking wsHttpBindings here, just basicHttpBindings with a simple "Add Service Reference" reference map file. I'm a sad panda. http://community.discountasp.net/emoticons/shakehead.gif
kgarove
01-30-2008, 06:31 AM
So now I discover how bleeding edge I am! I figured I was an hour away from deploying a production WCF service and I run into the svcmap parse error thingy. It took me a few hours but I have a workaround ready for production. :-) right....
Here'smy solution :
1. Deployed my IIS6-hosted WCF service and fixed-up all the standard stuff (needed to add a .svc file to the vroot e.g.). BTW, I developed the WCF service using the a WCF lib project type and the trusty VS 2008 built-in host. It's the only way to fly.
2. Deployed my ASP.NET/IIS6 web application which is the client to above WCF service. Fixed up the URL from the development URI to the above production endpoint from step 1.
3. Failed the &*^^&^%$* svcmap parse.
4. Cursed MS to eternal fire.
5. Opened up VS 2008 and created a simple C# console app and added a service reference to the WCF production endpoint from step 1.
6. Used VS 2008 to browse to the service definition and SCHWING!!!! I am now looking at the tool generated C# proxy for the production endpoint!!!
7. Had to fix up the generated code's namespace from step 6 to match the types in my client webapplication using VS search and replace. You will hit about 3-4 qualified type names in the generated code that you'll need to change.
8. Deleted the entire svcmap folder on the production vroot for web application (step2.).
9. Dropped the generated/fixed-up client code from step 6 into the app_code folder of the IIS6 web app client that was failing the svcmap parse.
10. Ran the web app and it worked!!!! No change to any code in the original client or server code base.
11. Now onto to securingthe whole deal usingx.509 certs. ala Juval's Internet security scenario. I'm sure that'll be a party.
wisemx
01-31-2008, 01:35 AM
Awesome Ken...Next Espresso is on me. http://community.discountasp.net/emoticons/wink.gif
jfasenmyer
01-31-2008, 05:10 AM
Can you post a working sample of the client & service? I tried creating a console app that consumed the WCF service and replacing the files in the App_Webreferences folder (there was no svcmap directory) but it made no difference. I'm also confused what exactly in step 9 was copied into the app_code folder. I'm happy to see that someone has managed to get the services working, I'm just confused as to what exactlyresolved the problem. I'm still stuck on steps 3 and 4 of your solution. Thank you.
KenG said...
So now I discover how bleeding edge I am! I figured I was an hour away from deploying a production WCF service and I run into the svcmap parse error thingy. It took me a few hours but I have a workaround ready for production. :-) right....
Here'smy solution :
1. Deployed my IIS6-hosted WCF service and fixed-up all the standard stuff (needed to add a .svc file to the vroot e.g.). BTW, I developed the WCF service using the a WCF lib project type and the trusty VS 2008 built-in host. It's the only way to fly.
2. Deployed my ASP.NET/IIS6 web application which is the client to above WCF service. Fixed up the URL from the development URI to the above production endpoint from step 1.
3. Failed the &*^^&^%$* svcmap parse.
4. Cursed MS to eternal fire.
5. Opened up VS 2008 and created a simple C# console app and added a service reference to the WCF production endpoint from step 1.
6. Used VS 2008 to browse to the service definition and SCHWING!!!! I am now looking at the tool generated C# proxy for the production endpoint!!!
7. Had to fix up the generated code's namespace from step 6 to match the types in my client webapplication using VS search and replace. You will hit about 3-4 qualified type names in the generated code that you'll need to change.
8. Deleted the entire svcmap folder on the production vroot for web application (step2.).
9. Dropped the generated/fixed-up client code from step 6 into the app_code folder of the IIS6 web app client that was failing the svcmap parse.
10. Ran the web app and it worked!!!! No change to any code in the original client or server code base.
11. Now onto to securingthe whole deal usingx.509 certs. ala Juval's Internet security scenario. I'm sure that'll be a party.
kgarove
01-31-2008, 11:56 AM
The fundemental problem created by this error is that there is no proxy on the deployment target if .svcmap cannot be parsed. If you can generate a proxy (C# in my case) and drop it into the app_code folder on the deployment machine, then ASP.NET will compile the type and bind to it at runtime. I looked at the venerable svcutil command line tool for WCF proxy generation and decided that it was not the rabbit hole I cared to drop intoat this time. It's pdaunting to say the least and good candidate for future study. If you're good with it, then that would be the best choice.
Instead, I reasoned that the VS 2008 console project type, since it cannot benefit from ASP.NET on-demand compilation,must have aVS 2008 generated proxy (maybe by invoking svcutil)that I could copy and use on the server. It turns out that this is actually the case. Again, I added a service ref. in my VS 2008 console application to the WCF service, and found the type name that was generated. I right-clicked on the type name in the source code editor and selected "Go to definition". This action took me to the VS generated source code for the WCF service proxy. From there, I made sure to edit the proxy to exactly match the fully namespace-qualified types I used in the failing project and dropped the result into the app_code folder. ASP.NET compilied the result and bound to it at resolved the types at runtime and all was working. Make sure to delete the svcmap folder in it's entirety on the server to rid yourself of the parse error.
kg
vBulletin® ©Jelsoft Enterprises Ltd.