when i create 2 asmx files in the same project one seems not to be compiled, what's wrong?

hello experts,
i've created a webservice project on vs 2008,
i've added to the project a second ".asmx" page with webservices on it.

locally i can query both files and look at web services definitions.

the project compile but there's still an error that avoid my second file to be exposed when deploy : error :

C:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Data.Entity.targets(40,5): error : Cannot process 'EticDownEplan.asmx' because it is not an EDMX file.

i've browse ee website for the matter but without success,
questiosn :
1. is it possible to create more than one ".asmx" file in a webservice project?
2. what are the steps i should control for such deployment.
3. any idea that would help to find a solution to this prob.

thank you in advance experts.

 
Erwin PombettAsked:
Who is Participating?
 
Kelvin McDanielSr. Developer/ConsultantCommented:
I think the only problem is that is appears your second service file shares the same Class name as one of your other files... probably an Entity Framework generated class.

The are two very simple solutions for the problem, after which you shouldn't have any problems compiling (from this issue):

1. Change the name of your second service to something other than EticDownEplan when you recreate or rename it.

2. Use the namespace feature (in the .cs file!) to group objects into separate "spaces". The structure is
namespace Service1Area
{
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    [System.Web.Script.Services.ScriptService]
    public class Service1 : System.Web.Services.WebService
    {
        // ... your code goes here ...
    }
}

Open in new window

0
 
Kelvin McDanielSr. Developer/ConsultantCommented:
You should be able to have multiple .asmx files in the project with no problems. You just have to make sure they don't clash/conflict with each other or anything else in the project/solution.

It sounds like there's some similar naming of objects in your project, and when you do that you have to be somewhat careful of how you "path" your objects. Specifically, I mean the namespace "path" that an object has inside its assembly.

Does the second .asmx file have the same namespace "path" as an .edmx file in the project?

Let's eliminate that possibility before we look elsewhere.
0
 
Erwin PombettAuthor Commented:
Hello ararc3

Thank you very much for your answer, thank you for the tip,

correcte me if i missunderstood please:  i shouldn't have the same namespace for both files as i'm doing.

for my first asmx created by default in the project :
    //[WebService(Namespace = "http://localhost/ede/")]
    [WebService(Namespace = "http://edews.ecowaste.ch/")]
    ...
    [System.Web.Script.Services.ScriptService]
    public class Service1 : System.Web.Services.WebService


second asmx:
   //[WebService(Namespace = "http://localhost/ede/")]
    [WebService(Namespace = "http://edews.ecowaste.ch/")] //avec dns
    ...
    [System.Web.Script.Services.ScriptService] // to be called with ASP.NET AJAX.
    public class EticDownEplan : System.Web.Services.WebService



as you can see, i toogle uncomment the namespace for compiling for the server
and when i'm working locally i toogle the comment again.

question : can i just let localhost as it seems to work in the server? or the other ? what is a good habit to get concerning ws ?

could you advice me on how to change the links names or whatever need to change to be able to have both in server machine as expected and not only locally.


0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

 
Erwin PombettAuthor Commented:
hello again,

i've changed as follow:

first asmx created by default :

    [WebService(Namespace = "http://edews.ecowaste.ch/default")]

second asmx :
    [WebService(Namespace = "http://edews.ecowaste.ch/")] //avec dns


but when compiling i receive the same error:
C:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Data.Entity.targets(40,5): error : Cannot process 'EticDownEplan.asmx' because it is not an EDMX file.

------------------------------------------------------------------------------------
second test
i've deleted the first amsx file that was created by default,
and the error stilll the same for the file, the project compile with success though.

========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========


thank you for further help, i dont know what to do .


0
 
Kelvin McDanielSr. Developer/ConsultantCommented:
I just created a VS2008 C# Webservice Application and I have two services in it running just fine. Here's what I've got for both instances...

===
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    [System.Web.Script.Services.ScriptService]
    public class Service1 : System.Web.Services.WebService

===
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    [System.Web.Script.Services.ScriptService]
    public class Service2 : System.Web.Services.WebService

===

... so you can see the namespace probably isn't the problem. That's a good thing. Let's adjust your code to make sure both namespaces are the same in the [WebService(Namespace = "")]. Doesn't matter which one you pick; just keep them consistent.

At this point I think something else is causing your build to fail. It seems like there is another file somewhere in your project that has the same name as your EticDownEplan() class. To test this, please...

1. Exclude the current EticDownEplan.asmx service (if you haven't already).
2. Add another service to your project but DON'T change anything in it.
3. Attempt a build and let me know what happens.
0
 
Erwin PombettAuthor Commented:
thank you for getting back,

OK, i set both namespace at the same url.
i have excluded EticDownEplan, added the new webservice, and compile,

compilation without error,

thank you for further help.
i still not know what to do ;)

0
 
Erwin PombettAuthor Commented:
i've read the first link and did  what was explained like adding the following line:

[assembly:AllowPartiallyTrustedCallers]
namespace Ecowaste.E_plan.ede

now i dont know if my web site is dynamically compiled, as i compiled it before deploy.

another question is : when i convert my project to webapplication, the contextual "change to web application" still there after ???? does it mean that the change did not work?

......
thank you for further help


0
 
Erwin PombettAuthor Commented:
i had a new idea, is that to click on the error received from the compilation,
now this is the file that get opened, i paste it if it can be of some help :




<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  <!-- This .targets file can be used by updating Microsoft.Common.targets to
         include the line below (as the last import element just before the end project tag)
      <Import Project="$(MSBuildBinPath)\Microsoft.Data.Entity.targets" Condition="Exists('$(MSBuildBinPath)\Microsoft.Data.Entity.targets')"/>
      -->

  <!-- The below ensures that "EntityDeploy" is available in the VS Build Action dropdown -->
  <ItemGroup>
    <AvailableItemName Include="EntityDeploy" />
  </ItemGroup>
 
  <UsingTask TaskName="EntityDeploy"
             AssemblyFile="$(MSBuildBinPath)\Microsoft.Data.Entity.Build.Tasks.dll">
  </UsingTask>

  <UsingTask TaskName="EntityClean"
             AssemblyFile="$(MSBuildBinPath)\Microsoft.Data.Entity.Build.Tasks.dll">
  </UsingTask>

  <PropertyGroup>
    <!-- EntityDeployDependsOn deliberately left empty so others can override this -->
    <EntityDeployDependsOn></EntityDeployDependsOn>
    <BuildDependsOn>
      EntityDeploy;
      $(BuildDependsOn)
    </BuildDependsOn>
  </PropertyGroup>

  <PropertyGroup>
    <CleanDependsOn>
      $(CleanDependsOn);
      EntityClean;
    </CleanDependsOn>
  </PropertyGroup>
 
  <Target Name="EntityDeploy"
          DependsOnTargets="$(EntityDeployDependsOn)" >

    <EntityDeploy
          Sources="@(EntityDeploy)"
          OutputPath="$(OutputPath)">
      <Output TaskParameter="EntityDataModelEmbeddedResources"
              ItemName="EmbeddedResource" />
    </EntityDeploy>

  </Target>

  <Target Name="EntityClean">
    <EntityClean
        Sources="@(EntityDeploy)"
        OutputPath="$(OutputPath)"
      />
  </Target>

</Project>


0
 
Erwin PombettAuthor Commented:
Hello azarc3,
thank you for your help,

what i did:
once i' clicked on the error in the output window of vs, some code displayed , i deleted that code.
i then try to restart a new project but was impossible! i did not what to do since i lookup for the file
that was "Microsoft.Data.Entity.targets" - i dont remember if it was a dll or not - what ever it was,
i deleted since it was empty -> 0Kg in the explorer.
after that , i restart a new app, recompile, and the problem was gone. i could deploy the web app.
until now i just connect to the two files in the web site, things seem ok.

what can be the consequences of having deleted such file?
is there a way to set this kind of basic file back?

Erwin
0
 
Kelvin McDanielSr. Developer/ConsultantCommented:
I'm not 100% certain of the consequences because the "shop" I work in doesn't use the Entity Framework. However, you may want to consider commenting "bad" code out instead of deleting it, just in case it actually is important.  :)

I assume that the section you're talking about was generated by Visual Studio, so if necessary I expect that it would regenerate the code (if you followed the same steps as before).

Congratulations on fixing your problem!
0
 
Erwin PombettAuthor Commented:
thank you very much azarc3,

btw, could you just tell me how you consider  "Entity Framework" ? only in a couple of lines.


for the code i've deleted it was not regenerate:
he was  in place at  : "C:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Data.Entity.targets.dll"

if you're using the same framework, could you push your file to this thread in order to have a hand on it if i need it later ;o) it's a few kb only.

i succeed to fix my problem but help me a lot, so i'm allowing you the points.

Erwin
0
 
Kelvin McDanielSr. Developer/ConsultantCommented:
Unfortunately, I don't have have the Entity Framework installed (anywhere) because it hasn't been a requirement for any of my personal or professional projects. Sorry!

You may actually have to repair the v3.5 framework to make sure that everything will work correctly again. That's the route I would take.

On the whole I think that ORMs like the Entity Framework are a good idea if they fit the project need and timeline you're trying to use them for. If the project doesn't have the time for it (meaning you're learning while you're actively working) then it may not be a great idea to implement just then.
0
 
Kelvin McDanielSr. Developer/ConsultantCommented:
Please don't forget to award the points. Thanks!  :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.