首页 新闻 会员 周边 捐助

在Application diagram中为什么生成不了”一般应用程序“project?

0
[已解决问题] 解决于 2008-12-26 13:19

如题!

chenming的主页 chenming | 初学一级 | 园豆:0
提问于:2008-12-25 17:44
< >
分享
最佳答案
0

Great question and very timely. I'm currently working on a walkthrough that explains how to represent class libraries in Application Designer. While there is no Class Library prototype on the toolbox, you can reference class libraries from Web services. Basically you're using the Web service as a facade for the business functions provided in the class libraries.

Here's the basic procedure to make this work:
1. Create an application diagram and add a Web service app to it.
2. Implement the Web service.
3. To get web.config to display in Solution Explorer, open the Settings and Constraints editor and add a new resource. For example, select NetSectionGroup under configuration, right-click, choose Add Resource, and add the SettingsSection.
4. Now select the solution node in Solution Explorer and add a new Class Library project to the solution.
5. Select the class library project node, right-click and choose Add Web Reference.
6. Add a Web reference to the Web service application you just implemented.
7. Right-click the Web application and choose Add Reference. In the Add Reference dialog, click on the Projects tab and select your class library.
8. Build the Class Library. This will create an app.config file in the solution.

At this point you have both an app.config and a web.config file in the solution. You're going to need to copy and paste sections from the app.config file into the web.config file.
 
9. Open app.config and web.config in Visual Studio.
10. Copy the applicationSettings section group from app.config and paste it into web.config (make sure you also copy in the configSections element). The section group will look something like this:

<configSections>

<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >

            <section name="ClassLibrary1.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

        </sectionGroup>

</configSections>


11. Now copy the applicationSettings section from app.config and paste it into web.config below configSections. That section will look something like this:

<applicationSettings>

   <ClassLibrary1.Settings>

         <setting name="ClassLibrary1_localhost_AdminWebService" serializeAs="String">

<value>http://localhost:1665/WebApplication1/AdminWebService.asmx</value>

         </setting>

   </ClassLibrary1.Settings>

</applicationSettings>

So now web.config will look something like this:

<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">

   <configSections>

         <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >

               <section name="ClassLibrary1.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

         </sectionGroup>

   </configSections>

   <appSettings>

   </appSettings>

   <applicationSettings>

         <ClassLibrary1.Settings>

               <setting name="ClassLibrary1_localhost_AdminWebService" serializeAs="String">

                  <value>http://localhost:1665/WebApplication1/AdminWebService.asmx</value>

               </setting>

         </ClassLibrary1.Settings>

   </applicationSettings>

   <connectionStrings/>

   <system.web>

12. Build the solution.
13. A consumer endpoint should appear on the Web application showing a reference to the class library.

Let me know if this works for you and if you have more questions.

RicoRui | 老鸟四级 |园豆:3663 | 2008-12-25 17:45
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册