locked
Need Help: Getting Error when using IIS but NOT ASP.NET Dev Server. Why? RRS feed

  • Question

  • User686339638 posted

    I'm getting an error when I try to run my WCF Service on IIS instead of ASP.NET Development Server. 

    Clarification: I don't get an error when I run the WCF Service when using a Windows Service or ASP.NET Development Server. ONLY IIS is the problem.

    I'm not exactly sure how these addresses work.

    I'm using a console app to test the service. I've never had problems with the service until i tried using the IIS port.

    Here is my app.config file of the console app. The top address and port number is the ASP.NET Dev Server port.  The second one is the IIS port.

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
        <system.serviceModel>
            <bindings>
                <wsHttpBinding>
                    <binding name="WSHttpBinding_IWebService" />
                </wsHttpBinding>
            </bindings>
            <client>
    			<!-- <endpoint address="http://localhost:5182/Service.svc" binding="wsHttpBinding"-->
                <endpoint address="http://localhost:9876/Service.svc" binding="wsHttpBinding"
                    bindingConfiguration="WSHttpBinding_IWebService" contract="MyWCF_ServiceReference.IWebService"
                    name="WSHttpBinding_IWebService">
                    <identity>
                        <dns value="localhost" />
                    </identity>
                </endpoint>
            </client>
        </system.serviceModel>
    </configuration>

    This is the error mesage:

    Is there a reason why the address below is different from the previous ones?

    http:// localhost:8732 /Design_Time_Addresses/WCFServiceLibrary/WebService/mex

    This is where it is crashing for some unknown reason. Its worth noting that part of the service works. Its only when it gets to ValidPerson that it crashes. (This also doesn't happen when using the ASP.NET Development Server port 5182. Only when using IIS port 9876)


    This shows that at the WCF Service itself, the ValidPerson is actually working.

    Thanks guys. I hope someone can help me.

    Saturday, November 16, 2013 11:50 AM

Answers

  • User686339638 posted

    I think I know the problem. After realizing that it works with my Windows Service, a friend called and i was talking to him and told him, it partially works with IIS. Its only when it gets to the database that is crashes! He said it must be a permissions issue. When i first did this, i was concerned about the application pool permissions, but i assumed it was ok because I was using the same app pool. That was on a different freaking server and a different database! So that's probably the problem!

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, November 16, 2013 3:51 PM

All replies

  • User1992938117 posted

    <endpoint address="http://localhost:9876/Service.svc" binding="wsHttpBinding"

    First thing i noticed that yu have specified port number along with binding, Do you have assigned the same port in iss for http bindings? Be default it is port 80.

    After hosting your service can you try to browse it without any port number i.e :

    <endpoint address="http://localhost/<YourApplicationName>\Service.svc"

    and the same you have to put in end point address.

    http://msdn.microsoft.com/en-us/library/ms733766%28v=vs.110%29.aspx

    Saturday, November 16, 2013 1:06 PM
  • User686339638 posted

    I did not understand everything you are saying. But i do appreciate the help. I'm trying to get you the information you need.  I hope this is what you need. Thanks very much!

    Let me mention too that all that code for the address was auto generated. I did not alter it except for the port numbers.

    For bigger picture: http://i.imgur.com/zAZl8ve.png

    Click here for a bigger picture: http://i.imgur.com/KfCiBX0.png

    I increased the size a little to make them easier to read.

    Saturday, November 16, 2013 1:40 PM
  • User1992938117 posted

    In first look didn't looks wrong, Could you try to consume the service by adding service reference in client project and cross check the web.config.

    Some references

    http://debugmode.net/2010/09/07/walkthrough-on-creating-wcf-4-0-service-and-hosting-in-iis-7-5/

    http://dotnetmentors.com/how-to-host-wcf-service-in-iis-7.aspx

    Saturday, November 16, 2013 2:14 PM
  • User686339638 posted

    I don't follow you exactly.

    I already have a Service Reference. Do you want me to delete it?  (At the moment that freightens me. I don't know what other problems i'll introduce and it seems to be working.)

    Instead of web.config, do you mean app.config? easy mistake i guess but need to be sure.

    I'll read over the links you provided thanks.

    Saturday, November 16, 2013 2:23 PM
  • User686339638 posted

    I responded to this. I wonder what happened.

    Ok I read the debug link. I deleted and re-created my Service Reference. It did create a different address but using the computer name it seems instead of localhost. 

    I'm still getting the same error, though.

    This is what the app config looks like now:

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
        <system.serviceModel>
            <bindings>
                <wsHttpBinding>
                    <binding name="WSHttpBinding_IWebService" />
                </wsHttpBinding>
            </bindings>
            <client>
                <endpoint address="http://keoki:9876/Service.svc" binding="wsHttpBinding"
                    bindingConfiguration="WSHttpBinding_IWebService" contract="MyWCF_ServiceReference.IWebService"
                    name="WSHttpBinding_IWebService">
                    <identity>
                        <dns value="localhost" />
                    </identity>
                </endpoint>
            </client>
        </system.serviceModel>
    </configuration>



    Saturday, November 16, 2013 2:55 PM
  • User686339638 posted

    As I'm starting to learn how all this works. I find out a little more info. Ok. the Windows Service and the ASP.NET Development Server works!!!

    Only IIS is not working.

    Saturday, November 16, 2013 3:18 PM
  • User686339638 posted

    I think I know the problem. After realizing that it works with my Windows Service, a friend called and i was talking to him and told him, it partially works with IIS. Its only when it gets to the database that is crashes! He said it must be a permissions issue. When i first did this, i was concerned about the application pool permissions, but i assumed it was ok because I was using the same app pool. That was on a different freaking server and a different database! So that's probably the problem!

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, November 16, 2013 3:51 PM