Web services access from ASP.NET 2.0 web site

Discussion in 'ASP.NET 2.0' started by cioina, Jun 9, 2008.

  1. Hi Mark and Bruce,
    I have a web site in root dir. I've put web services in /App_Themes/WebServices dir. Now I canaccess web services from IE without problem.
    but I can't access web services from web site. I got anerror System.Web.HttpException: The file '/App_Themes/WebServices/MyWebService.asmx' is in the special directory 'App_Themes', which is not allowed. I don't want to use subdomains. Please help me.

    Alexei Cioina.
     
  2. You'll have to place the web service in the root or another directory. The App_Themes is indeed a special ASP.NET directory and should not be used for anything but themes.

    Aristotle

    DiscountASP.NET
    www.DiscountASP.NET
     
  3. I've tried that, but I've got more serious exception (I can't remember it).


    Aristotle, thank you very much.
     
  4. Hereare the errors


    From web site


    System.Configuration.ConfigurationErrorsException: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS




    From web service





    System.InvalidOperationException: The XML Web service help page encountered an internal error. ---> System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.NullReferenceException: Object reference not set to an instance of an object.
    at ASP.defaultwsdlhelpgenerator_aspx.FindHttpBinding(String verb)
    at ASP.defaultwsdlhelpgenerator_aspx.__Render__control20(HtmlTextWriter __w, Control parameterContainer)
    at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
    at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer)
    at System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer)
    at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
    at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)
    at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)
    at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
    at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer)
    at System.Web.UI.Page.Render(HtmlTextWriter writer)
    at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
    at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)
    at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)
    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    --- End of inner exception stack trace ---
    at System.Web.UI.Page.HandleError(Exception e)
    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    at System.Web.UI.Page.ProcessRequest()
    at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
    at System.Web.UI.Page.ProcessRequest(HttpContext context)
    at ASP.defaultwsdlhelpgenerator_aspx.ProcessRequest(HttpContext context)
    at System.Web.Services.Protocols.DocumentationServerProtocol.WriteReturns(Object[] returnValues, Stream outputStream)
    --- End of inner exception stack trace ---
    at System.Web.Services.Protocols.WebServiceHandler.WriteException(Exception e)
    at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()
    at System.Web.Services.Protocols.SyncSessionlessHandler.ProcessRequest(HttpContext context)
    at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
    at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously);

    Post Edited (cioina) : 6/9/2008 7:28:57 PM GMT
     
  5. I placed in root dir. Now I CAN'T access web services from IE. Please see the errors above.

    Also I have

    Current Path:
    <NOBR> \MyName\WebServices
    </NOBR>
    This folder is setup as a web application. Click the button below to remove the Web Application.

    Please help.

    Post Edited (cioina) : 6/9/2008 7:49:45 PM GMT
     
  6. As far as the first error message is concerned,it is because you haven't set your sub-folder as a web application (this should go away if you already have,as per your previosu post).On the other hand 'Object reference not set to an instance of an object' is a very generic error message.it is usually caused due to an object or a variable who's value is not set (is empty or null) and you are trying to perform an operation on it.For example:

    lets say you have a variable 'A' and you are trying to convert it to string by doing something like A.ToString(),but A has null value or is empty,you will get an error 'Object reference not set to an instance of an object' .Hope this makes it clear.

    Vikram

    DiscountASP.NET
    www.DiscountASP.NET
     
  7. I did stop/start IIS from DASP panel but got the same errors. Web site and web service work very good on my local machine,


    because they use differet ports.


    Can I open a tiket for this problem ?
     
  8. Hi,


    I have no chance that my question to be answered. [​IMG]
     
  9. Hi,
    I haven't created any ASP.NET Web Services here but I will try to help you.
    What is the main purpose of creating a Web Service? Just for experiments?
    Most everyone I've helped so far do this in Silverlight, as an example, are only doing it for kicks. [​IMG]

    Have you searched http://www.CodePlex.com for examples to use?
    Salute,
    Mark
     
  10. [​IMG]
    Hi Mark,
    I need Web service (WS)to do all operatins with my Database. I don't want to connect my database direct from Web site.
    MyWS should work like Reporting Services does. Once again, If I put my WS in '/App_Themes' then I can access it fromIE (not from my web site hosted on DASP). To be more clear, I want that my WS to work with its own web.config and its own Global.asax (in '/App_Themes' WS woks like that).

    Thank you very much.


    Post Edited (cioina) : 6/10/2008 5:39:15 PM GMT
     
  11. Alrighty..Can't promise anything but I will look into this. [​IMG]
     
  12. I received a message from DASP support:


    Dear Customer,

    Although we do not provide application level support, I did notice your mention of the path you are using.

    The path to your root directory is: "e:\web\MyName\htdocs"

    If you wanted to access something in your webservices subfolder the path would be "e:\web\MyName\htdocs\webservices"

    Please verify that this information is correct in your code.

    Please let us know if you have any other questions.

    - Mike O.

    DiscountASP.NET - Microsoft Gold Certified Partner
    - asp.netPRO Magazine 2007 Readers' Choice Award for Best Hosting Service
    - Visual Studio Magazine 2007 Readers' Choice Award for Best Hosting Service



    Can somebody explain "Although we do not provide application level support..."


    I used Web Application Toolfrom DASP to install application in "e:\web\MyName\htdocs\webservices" (I suppose).


    What this tooldo?


    I already have a web site in "e:\web\MyName\htdocs"


    "If you wanted to access something in your webservices subfolder the path would be "e:\web\MyName\htdocs\webservices"...
    I don't want to access something from thispath form Web site. I want just to access my web service from this location. It is a URL not a path.


    Please help.
     

Share This Page